Class: USPS::Request::SignatureConfirmation
- Defined in:
- lib/usps/request/signature_confirmation.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(to, from, weight, service = 'Priority') ⇒ SignatureConfirmation
constructor
A new instance of SignatureConfirmation.
Methods inherited from Base
#api, config, #response_for, #secure?, #send!
Constructor Details
#initialize(to, from, weight, service = 'Priority') ⇒ SignatureConfirmation
Returns a new instance of SignatureConfirmation.
12 13 14 15 16 17 |
# File 'lib/usps/request/signature_confirmation.rb', line 12 def initialize(to, from, weight, service = 'Priority') @to = to @from = from @weight = weight @service = service end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
10 11 12 |
# File 'lib/usps/request/signature_confirmation.rb', line 10 def from @from end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
10 11 12 |
# File 'lib/usps/request/signature_confirmation.rb', line 10 def service @service end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
10 11 12 |
# File 'lib/usps/request/signature_confirmation.rb', line 10 def to @to end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
10 11 12 |
# File 'lib/usps/request/signature_confirmation.rb', line 10 def weight @weight end |
Instance Method Details
#build ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/usps/request/signature_confirmation.rb', line 19 def build super do |builder| builder.tag!('Option', '1') builder.tag!('ImageParameters') [ [self.from, 'From'], [self.to, 'To'] ].each do |address, prefix| builder.tag!("#{prefix}Name", address.name) builder.tag!("#{prefix}Firm", address.company) builder.tag!("#{prefix}Address1", address.extra_address) builder.tag!("#{prefix}Address2", address.address) builder.tag!("#{prefix}City", address.city) builder.tag!("#{prefix}State", address.state) builder.tag!("#{prefix}Zip5", address.zip5) builder.tag!("#{prefix}Zip4", address.zip4) end builder.tag!('WeightInOunces', self.weight) builder.tag!('ServiceType', self.service) builder.tag!('ImageType', 'TIF') end end |