Class: CanadaPost::Request::Manifest
- Defined in:
- lib/canada_post/request/manifest.rb
Constant Summary
Constants inherited from Base
Base::OPTION_CODES, Base::PRODUCTION_URL, Base::SERVICE_CODES, Base::TEST_CONTRACT_ID, Base::TEST_URL
Instance Attribute Summary collapse
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#group_id ⇒ Object
Returns the value of attribute group_id.
-
#phone ⇒ Object
Returns the value of attribute phone.
Instance Method Summary collapse
- #get_artifact(url) ⇒ Object
- #get_manifest(url) ⇒ Object
-
#initialize(credentials, options = {}) ⇒ Manifest
constructor
A new instance of Manifest.
- #process_request ⇒ Object
Methods inherited from Base
#client, #parse_response, #process_response, #sanitize_response_keys
Constructor Details
#initialize(credentials, options = {}) ⇒ Manifest
Returns a new instance of Manifest.
7 8 9 10 11 12 13 14 15 |
# File 'lib/canada_post/request/manifest.rb', line 7 def initialize(credentials, ={}) @credentials = credentials if .present? @phone = [:phone] @destination = [:destination] @group_id = [:group_id] end super(credentials) end |
Instance Attribute Details
#destination ⇒ Object
Returns the value of attribute destination.
5 6 7 |
# File 'lib/canada_post/request/manifest.rb', line 5 def destination @destination end |
#group_id ⇒ Object
Returns the value of attribute group_id.
5 6 7 |
# File 'lib/canada_post/request/manifest.rb', line 5 def group_id @group_id end |
#phone ⇒ Object
Returns the value of attribute phone.
5 6 7 |
# File 'lib/canada_post/request/manifest.rb', line 5 def phone @phone end |
Instance Method Details
#get_artifact(url) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/canada_post/request/manifest.rb', line 36 def get_artifact(url) self.class.get( url, headers: artifact_header, basic_auth: @authorization ) end |
#get_manifest(url) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/canada_post/request/manifest.rb', line 27 def get_manifest(url) api_response = self.class.get( url, headers: manifest_header, basic_auth: @authorization ) process_response(api_response) end |
#process_request ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/canada_post/request/manifest.rb', line 17 def process_request api_response = self.class.post( api_url, body: build_xml, headers: manifest_header, basic_auth: @authorization ) process_response(api_response) end |