Module: AwesomeUsps::InternationalMailLabels

Included in:
USPS
Defined in:
lib/awesome_usps/international_mail_labels.rb

Instance Method Summary collapse

Instance Method Details

#canned_express_mail_international_label_testObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/awesome_usps/international_mail_labels.rb', line 12

def canned_express_mail_international_label_test
  sender = Location.new( :first_name=> "John",  :last_name => "Berger", :address2 => "6406 Ivy Lane",  :state => 'MD', :city => 'Greenbelt', :zip5 => '20770', :phone => "2016585989")
  receiver =Location.new( :name=> "Fairfax Post Office",  :address2 =>"10660 Page Ave",   :city => 'Tokyo', :zip5 => "22030", :country => "Japan" )
  po_box_flag ="N"
  content_type = "GIFT"
  image_layout="ALLINONEFILE"
  image_type = "PDF"
  items = [InternationalItem.new(:ounces => 50, :country => "United States", :quantity => "50", :description => "Pens Pens Pens", :value => 50.00), InternationalItem.new(:ounces => 40, :country => "United States", :quantity => "50", :description => "Pens Pens Pens", :value => 50.00)]
  request_api = "ExpressMailIntlCertifyRequest"
  label_type="1"
  options ={}
  request= international_mail_labels_xml(request_api, sender, receiver, items, content_type, image_type, po_box_flag, image_layout, label_type, options)
  gateway_commit(:express_mail_certify, 'ExpressMailIntlCertify', request, :ssl, image_type)
end

#canned_first_class_mail_international_label_testObject



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/awesome_usps/international_mail_labels.rb', line 61

def canned_first_class_mail_international_label_test
  sender = Location.new( :first_name=> "John",  :last_name => "Berger", :address2 => "6406 Ivy Lane",  :state => 'MD', :city => 'Greenbelt', :zip5 => '20770', :phone => "2016585989")
  receiver =Location.new( :name=> "Fairfax Post Office",  :address2 =>"10660 Page Ave",   :city => 'Tokyo', :zip5 => "22030", :country => "Japan" )

  po_box_flag ="N"
  content_type = "GIFT"
  image_layout="ALLINONEFILE"
  image_type = "PDF"
  items = [InternationalItem.new(:ounces => 10, :country => "United States", :quantity => "50", :description => "Pens Pens Pens", :value => 50.00), InternationalItem.new(:ounces => 10, :country => "United States", :quantity => "50", :description => "Pens Pens Pens", :value => 50.00)]
  request_api = "FirstClassMailIntlCertifyRequest"
  label_type="1"
  options ={}
  request= first_class_international_mail_labels_xml(request_api, sender, receiver, items, content_type, image_type, po_box_flag,
  image_layout, label_type, options)
  gateway_commit(:first_class_mail_certify, 'FirstClassMailIntlCertify', request, :ssl, image_type)
end

#canned_priority_mail_international_label_testObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/awesome_usps/international_mail_labels.rb', line 36

def canned_priority_mail_international_label_test
  sender = Location.new( :first_name=> "John",  :last_name => "Berger", :address2 => "6406 Ivy Lane",  :state => 'MD', :city => 'Greenbelt', :zip5 => '20770', :phone => "2016585989")
  receiver =Location.new( :name=> "Fairfax Post Office",  :address2 =>"10660 Page Ave",   :city => 'Tokyo', :zip5 => "22030", :country => "Japan" )
  po_box_flag ="N"
  content_type = "GIFT"
  image_layout="ALLINONEFILE"
  image_type = "PDF"
  items = [InternationalItem.new(:ounces => 50, :country => "United States", :quantity => "50", :description => "Pens Pens Pens", :value => 50.00), InternationalItem.new(:ounces => 40, :country => "United States", :quantity => "50", :description => "Pens Pens Pens", :value => 50.00)]
  request_api = "PriorityMailIntlCertifyRequest"
  label_type="1"
  options ={}
  request= international_mail_labels_xml(request_api, sender, receiver, items, content_type, image_type, po_box_flag,
  image_layout, label_type, options)
  gateway_commit(:priority_mail_certify, 'PriorityMailIntlCertify', request, :ssl, image_type)
end

#express_mail_international_label(sender, receiver, items, content_type, image_type, po_box_flag = "N", request_api = "ExpressMailIntlRequest", image_layout = "ALLINONEFILE", label_type = "1", options = {}) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/awesome_usps/international_mail_labels.rb', line 3

def express_mail_international_label(sender, receiver, items, content_type, image_type, po_box_flag ="N",  request_api = "ExpressMailIntlRequest",
  image_layout="ALLINONEFILE", label_type="1", options={})
  Array(items) if not items.is_a? Array
  request = international_mail_labels_xml(request_api, sender, receiver, items, content_type, image_type, po_box_flag,
  image_layout, label_type, options)
  #YES THE API IS THAT STUPID THAT WE MUST PASS WHAT TYPE OF MIME TYPE!
  gateway_commit(:express_mail, 'ExpressMailIntl', request, :ssl, image_type)
end

#first_class_international_label(sender, receiver, items, content_type, image_type, po_box_flag = "N", image_layout = "ALLINONEFILE", label_type = "1", request_api = "FirstClassMailIntlRequest", options = {}) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/awesome_usps/international_mail_labels.rb', line 52

def first_class_international_label(sender, receiver, items, content_type, image_type, po_box_flag ="N",
  image_layout="ALLINONEFILE", label_type="1", request_api = "FirstClassMailIntlRequest", options={})
  Array(items) if not items.is_a? Array
  request = first_class_international_mail_labels_xml(request_api, sender, receiver, items, content_type, image_type, po_box_flag,
  image_layout, label_type, options)
  #YES THE API IS THAT STUPID THAT WE MUST PASS WHAT TYPE OF MIME TYPE!
  gateway_commit(:first_class_mail, 'FirstClassMailIntl', request, :ssl, image_type)
end

#priority_mail_international_label(sender, receiver, items, content_type, image_type, po_box_flag = "N", image_layout = "ALLINONEFILE", label_type = "1", request_api = "PriorityMailIntlRequest", options = {}) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/awesome_usps/international_mail_labels.rb', line 27

def priority_mail_international_label(sender, receiver, items, content_type, image_type, po_box_flag ="N",
  image_layout="ALLINONEFILE", label_type="1", request_api = "PriorityMailIntlRequest", options={})
  Array(items) if not items.is_a? Array
  request = international_mail_labels_xml(request_api, sender, receiver, items, content_type, image_type, po_box_flag,
  image_layout, label_type, options)
  #YES THE API IS THAT STUPID THAT WE MUST PASS WHAT TYPE OF MIME TYPE!
  gateway_commit(:priority_mail, 'PriorityMailIntl', request, :ssl, image_type)
end