Class: CatPrint

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/catprint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(order = nil) ⇒ CatPrint

Returns a new instance of CatPrint.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/catprint.rb', line 64

def initialize(order=nil)
  @order                      = order
  @action_print_job_xml       = action_print_job_xml
  @production_center_id       = production_center_id
  @payment_method             = payment_method
  @shipping_speed             = shipping_speed
  @job_copies                 = job_copies
  @job_full_bleed             = job_full_bleed
  @job_paper_id               = job_paper_id
  @job_finishing_option_id    = job_finishing_option_id
  @job_fold_across_long_edge  = job_fold_across_long_edge
  @job_front_imaging          = job_front_imaging
  @job_back_imaging           = job_back_imaging
  @job_flip_on_long_edge      = job_flip_on_long_edge
  @job_pages                  = job_pages
  @panel_number               = panel_number
  @page_number                = page_number
  @rotation                   = rotation
end

Instance Attribute Details

#billing_address_1Object

Returns the value of attribute billing_address_1.



6
7
8
# File 'lib/catprint.rb', line 6

def billing_address_1
  @billing_address_1
end

#billing_address_2Object

Returns the value of attribute billing_address_2.



6
7
8
# File 'lib/catprint.rb', line 6

def billing_address_2
  @billing_address_2
end

#billing_cityObject

Returns the value of attribute billing_city.



6
7
8
# File 'lib/catprint.rb', line 6

def billing_city
  @billing_city
end

#billing_companyObject

Returns the value of attribute billing_company.



6
7
8
# File 'lib/catprint.rb', line 6

def billing_company
  @billing_company
end

#billing_countryObject

Returns the value of attribute billing_country.



6
7
8
# File 'lib/catprint.rb', line 6

def billing_country
  @billing_country
end

#billing_nameObject

Returns the value of attribute billing_name.



6
7
8
# File 'lib/catprint.rb', line 6

def billing_name
  @billing_name
end

#billing_phoneObject

Returns the value of attribute billing_phone.



6
7
8
# File 'lib/catprint.rb', line 6

def billing_phone
  @billing_phone
end

#billing_stateObject

Returns the value of attribute billing_state.



6
7
8
# File 'lib/catprint.rb', line 6

def billing_state
  @billing_state
end

#billing_zipObject

Returns the value of attribute billing_zip.



6
7
8
# File 'lib/catprint.rb', line 6

def billing_zip
  @billing_zip
end

#card_expirationObject

Returns the value of attribute card_expiration.



6
7
8
# File 'lib/catprint.rb', line 6

def card_expiration
  @card_expiration
end

#card_holder_first_nameObject

Returns the value of attribute card_holder_first_name.



6
7
8
# File 'lib/catprint.rb', line 6

def card_holder_first_name
  @card_holder_first_name
end

#card_holder_last_nameObject

Returns the value of attribute card_holder_last_name.



6
7
8
# File 'lib/catprint.rb', line 6

def card_holder_last_name
  @card_holder_last_name
end

#card_numberObject

Returns the value of attribute card_number.



6
7
8
# File 'lib/catprint.rb', line 6

def card_number
  @card_number
end

#card_typeObject

Returns the value of attribute card_type.



6
7
8
# File 'lib/catprint.rb', line 6

def card_type
  @card_type
end

#drop_ship_address_1Object

Returns the value of attribute drop_ship_address_1.



6
7
8
# File 'lib/catprint.rb', line 6

def drop_ship_address_1
  @drop_ship_address_1
end

#drop_ship_address_2Object

Returns the value of attribute drop_ship_address_2.



6
7
8
# File 'lib/catprint.rb', line 6

def drop_ship_address_2
  @drop_ship_address_2
end

#drop_ship_cityObject

Returns the value of attribute drop_ship_city.



6
7
8
# File 'lib/catprint.rb', line 6

def drop_ship_city
  @drop_ship_city
end

#drop_ship_companyObject

Returns the value of attribute drop_ship_company.



6
7
8
# File 'lib/catprint.rb', line 6

def drop_ship_company
  @drop_ship_company
end

#drop_ship_countryObject

Returns the value of attribute drop_ship_country.



6
7
8
# File 'lib/catprint.rb', line 6

def drop_ship_country
  @drop_ship_country
end

#drop_ship_packing_slip_urlObject

Returns the value of attribute drop_ship_packing_slip_url.



6
7
8
# File 'lib/catprint.rb', line 6

def drop_ship_packing_slip_url
  @drop_ship_packing_slip_url
end

#drop_ship_phoneObject

Returns the value of attribute drop_ship_phone.



6
7
8
# File 'lib/catprint.rb', line 6

def drop_ship_phone
  @drop_ship_phone
end

#drop_ship_stateObject

Returns the value of attribute drop_ship_state.



6
7
8
# File 'lib/catprint.rb', line 6

def drop_ship_state
  @drop_ship_state
end

#drop_ship_zipObject

Returns the value of attribute drop_ship_zip.



6
7
8
# File 'lib/catprint.rb', line 6

def drop_ship_zip
  @drop_ship_zip
end

#emailObject

Returns the value of attribute email.



6
7
8
# File 'lib/catprint.rb', line 6

def email
  @email
end

#job_back_imagingObject

Returns the value of attribute job_back_imaging.



6
7
8
# File 'lib/catprint.rb', line 6

def job_back_imaging
  @job_back_imaging
end

#job_copiesObject

Returns the value of attribute job_copies.



6
7
8
# File 'lib/catprint.rb', line 6

def job_copies
  @job_copies
end

#job_envelope_idObject

Returns the value of attribute job_envelope_id.



6
7
8
# File 'lib/catprint.rb', line 6

def job_envelope_id
  @job_envelope_id
end

#job_finishing_option_idObject

Returns the value of attribute job_finishing_option_id.



6
7
8
# File 'lib/catprint.rb', line 6

def job_finishing_option_id
  @job_finishing_option_id
end

#job_flip_on_long_edgeObject

Returns the value of attribute job_flip_on_long_edge.



6
7
8
# File 'lib/catprint.rb', line 6

def job_flip_on_long_edge
  @job_flip_on_long_edge
end

#job_fold_across_long_edgeObject

Returns the value of attribute job_fold_across_long_edge.



6
7
8
# File 'lib/catprint.rb', line 6

def job_fold_across_long_edge
  @job_fold_across_long_edge
end

#job_front_imagingObject

Returns the value of attribute job_front_imaging.



6
7
8
# File 'lib/catprint.rb', line 6

def job_front_imaging
  @job_front_imaging
end

#job_full_bleedObject

Returns the value of attribute job_full_bleed.



6
7
8
# File 'lib/catprint.rb', line 6

def job_full_bleed
  @job_full_bleed
end

#job_heightObject

Returns the value of attribute job_height.



6
7
8
# File 'lib/catprint.rb', line 6

def job_height
  @job_height
end

#job_nameObject

Returns the value of attribute job_name.



6
7
8
# File 'lib/catprint.rb', line 6

def job_name
  @job_name
end

#job_pagesObject

Returns the value of attribute job_pages.



6
7
8
# File 'lib/catprint.rb', line 6

def job_pages
  @job_pages
end

#job_paper_idObject

Returns the value of attribute job_paper_id.



6
7
8
# File 'lib/catprint.rb', line 6

def job_paper_id
  @job_paper_id
end

#job_widthObject

Returns the value of attribute job_width.



6
7
8
# File 'lib/catprint.rb', line 6

def job_width
  @job_width
end

#orderObject

Returns the value of attribute order.



6
7
8
# File 'lib/catprint.rb', line 6

def order
  @order
end

#page_numberObject

Returns the value of attribute page_number.



6
7
8
# File 'lib/catprint.rb', line 6

def page_number
  @page_number
end

#panel_numberObject

Returns the value of attribute panel_number.



6
7
8
# File 'lib/catprint.rb', line 6

def panel_number
  @panel_number
end

#panel_source_fileObject

Returns the value of attribute panel_source_file.



6
7
8
# File 'lib/catprint.rb', line 6

def panel_source_file
  @panel_source_file
end

#passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/catprint.rb', line 6

def password
  @password
end

#payment_amountObject

Returns the value of attribute payment_amount.



6
7
8
# File 'lib/catprint.rb', line 6

def payment_amount
  @payment_amount
end

#payment_methodObject

Returns the value of attribute payment_method.



6
7
8
# File 'lib/catprint.rb', line 6

def payment_method
  @payment_method
end

#production_center_idObject

Returns the value of attribute production_center_id.



6
7
8
# File 'lib/catprint.rb', line 6

def production_center_id
  @production_center_id
end

#rotationObject

Returns the value of attribute rotation.



6
7
8
# File 'lib/catprint.rb', line 6

def rotation
  @rotation
end

#shipping_address_1Object

Returns the value of attribute shipping_address_1.



6
7
8
# File 'lib/catprint.rb', line 6

def shipping_address_1
  @shipping_address_1
end

#shipping_address_2Object

Returns the value of attribute shipping_address_2.



6
7
8
# File 'lib/catprint.rb', line 6

def shipping_address_2
  @shipping_address_2
end

#shipping_cityObject

Returns the value of attribute shipping_city.



6
7
8
# File 'lib/catprint.rb', line 6

def shipping_city
  @shipping_city
end

#shipping_companyObject

Returns the value of attribute shipping_company.



6
7
8
# File 'lib/catprint.rb', line 6

def shipping_company
  @shipping_company
end

#shipping_countryObject

Returns the value of attribute shipping_country.



6
7
8
# File 'lib/catprint.rb', line 6

def shipping_country
  @shipping_country
end

#shipping_instructionsObject

Returns the value of attribute shipping_instructions.



6
7
8
# File 'lib/catprint.rb', line 6

def shipping_instructions
  @shipping_instructions
end

#shipping_nameObject

Returns the value of attribute shipping_name.



6
7
8
# File 'lib/catprint.rb', line 6

def shipping_name
  @shipping_name
end

#shipping_phoneObject

Returns the value of attribute shipping_phone.



6
7
8
# File 'lib/catprint.rb', line 6

def shipping_phone
  @shipping_phone
end

#shipping_speedObject

Returns the value of attribute shipping_speed.



6
7
8
# File 'lib/catprint.rb', line 6

def shipping_speed
  @shipping_speed
end

#shipping_stateObject

Returns the value of attribute shipping_state.



6
7
8
# File 'lib/catprint.rb', line 6

def shipping_state
  @shipping_state
end

#shipping_zipObject

Returns the value of attribute shipping_zip.



6
7
8
# File 'lib/catprint.rb', line 6

def shipping_zip
  @shipping_zip
end

Instance Method Details

#action_print_job_xml(*args) ⇒ Object



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/catprint.rb', line 152

def action_print_job_xml(*args)
  action_print_job_xml = <<-EOF
<?xml version="1.0" encoding="UTF-8"?>
<action-print-job>
  <production-center-id type="integer">#{@production_center_id}</production-center-id>
  <submitter-id>#{@email}</submitter-id>
  <submitter-password>#{@password}</submitter-password>
  <payment-method>#{@payment_method}</payment-method>
  <payment-amount>#{@payment_amount}</payment-amount>
  <payment-profile-cc-expiration>#{@card_expiration}</payment-profile-cc-expiration>
  <payment-profile-cc-number>#{@card_number}</payment-profile-cc-number>
  <payment-profile-cc-type>#{@card_type}</payment-profile-cc-type>
  <payment-profile-first-name>#{@card_holder_first_name}</payment-profile-first-name>
  <payment-profile-last-name>#{@card_holder_last_name}</payment-profile-last-name>
  <billing-company>#{@billing_company}</billing-company>
  <billing-name>#{@billing_name}</billing-name>
  <billing-address-1>#{@billing_address_1}</billing-address-1>
  <billing-address-2>#{@billing_address_2}</billing-address-2>
  <billing-city>#{@billing_city}</billing-city>
  <billing-state>#{@billing_state}</billing-state>
  <billing-zip>#{@billing_zip}</billing-zip>
  <billing-country>#{@billing_country}</billing-country>
  <billing-phone>#{@billing_phone}</billing-phone>
  <shipping-company>#{@shipping_company}</shipping-company>
  <shipping-name>#{@shipping_name}</shipping-name>
  <shipping-address-1>#{@shipping_address_1}</shipping-address-1>
  <shipping-address-2>#{@shipping_address_2}</shipping-address-2>
  <shipping-city>#{@shipping_city}</shipping-city>
  <shipping-state>#{@shipping_state}</shipping-state>
  <shipping-zip>#{@shipping_zip}</shipping-zip>
  <shipping-country>#{@shipping_country}</shipping-country>
  <shipping-phone>#{@shipping_phone}</shipping-phone>
  <shipping-speed>#{@shipping_speed}</shipping-speed>
  <shipping-instructions>#{@shipping_instructions}</shipping-instructions>
  <drop-ship-company>#{@drop_ship_company}</drop-ship-company>
  <drop-ship-address-1>#{@drop_ship_address_1}</drop-ship-address-1>
  <drop-ship-address-2>#{@drop_ship_address_2}</drop-ship-address-2>
  <drop-ship-city>#{@drop_ship_city}</drop-ship-city>
  <drop-ship-state>#{@drop_ship_state}</drop-ship-state>
  <drop-ship-zip>#{@drop_ship_zip}</drop-ship-zip>
  <drop-ship-country>#{@drop_ship_country}</drop-ship-country>
  <drop-ship-phone>#{@drop_ship_phone}</drop-ship-phone>
  <drop-ship-packing-slip-url>#{@drop_ship_packing_slip_url}</drop-ship-packing-slip-url>
  <jobs type="array">
    <job>
      <name>#{@job_name}</name>
      <copies>#{@job_copies}</copies>
      <width>#{@job_width}</width>
      <height>#{@job_height}</height>
      <full-bleed>#{@job_full_bleed}</full-bleed>
      <paper-id>#{@job_paper_id}</paper-id>
      <envelope-id>#{@job_envelope_id}</envelope-id>
      <finishing-option-id>#{@job_finishing_option_id}</finishing-option-id>
      <fold-across-long-edge>#{@job_fold_across_long_edge}</fold-across-long-edge>
      <front-imaging>#{@job_front_imaging}</front-imaging>
      <back-imaging>#{@job_back_imaging}</back-imaging>
      <flip-on-long-edge>#{@job_flip_on_long_edge}</flip-on-long-edge>
      <pages>#{@job_pages}</pages>
      <panels type="array">
        <panel>
          <panel-source-file>#{@panel_source_file}</panel-source-file>
          <panel-number>#{@panel_number}</panel-number>
          <page-number>#{@page_number}</page-number>
          <rotation>#{@rotation}</rotation>
        </panel>
      </panels>
    </job>
  </jobs>
</action-print-job>
  EOF
end

#send_job(body) ⇒ Object



86
87
88
89
90
# File 'lib/catprint.rb', line 86

def send_job(body)
  self.class.post "/action_print", :body => { :email => @email,
                                              :password => @password,
                                              :action_print_job_xml => body }
end