Class: AusPostAPI::PAC::Endpoint
- Defined in:
- lib/aus_post_api/pac/endpoint.rb
Overview
Abstract class that defines a PAC::Endpoint. It implements the ‘uri` & `headers` methods and expects the `api_uri` method to be implemented.
Direct Known Subclasses
Country, DomesticLetterSize, DomesticLetterThickness, DomesticLetterWeight, DomesticParcelSize, DomesticParcelType, DomesticParcelWeight, DomesticPostcodeSearch, InternationalLetterWeight, InternationalParcelWeight, PostageLetterDomesticCalculate, PostageLetterDomesticService, PostageLetterInternationalCalculate, PostageLetterInternationalService, PostageParcelDomesticCalculate, PostageParcelDomesticService, PostageParcelInternationalCalculate, PostageParcelInternationalService
Defined Under Namespace
Classes: ImplementationError, InvalidFormatError, NoAuthKeyProvidedError, NoFormatProvidedError
Constant Summary collapse
- LIVE_URI =
'https://auspost.com.au/api'
- TEST_URI =
'https://test.npe.auspost.com.au'
- TEST_KEY =
'28744ed5982391881611cca6cf5c240'
- FORMATS =
['json', 'xml']
Instance Method Summary collapse
Methods inherited from Endpoint
Methods included from Endpoint::Attributes
Constructor Details
This class inherits a constructor from AusPostAPI::Endpoint
Instance Method Details
#headers ⇒ Object
15 16 17 |
# File 'lib/aus_post_api/pac/endpoint.rb', line 15 def headers { "AUTH-KEY" => @config[:TEST] ? TEST_KEY : auth_key } end |
#uri ⇒ Object
11 12 13 |
# File 'lib/aus_post_api/pac/endpoint.rb', line 11 def uri "#{base_uri}/#{api_uri}.#{format}?#{params}" end |