Class: AusPostAPI::DCE::Endpoint

Inherits:
Endpoint
  • Object
show all
Defined in:
lib/aus_post_api/dce/endpoint.rb

Overview

Abstract class that defines a DCE::Endpoint. It implements the ‘uri` & `headers` methods and expects the `api_uri` method to be implemented.

Direct Known Subclasses

ValidateAustralianAddress

Defined Under Namespace

Classes: ImplementationError, InvalidFormatError, NoFormatProvidedError, NoHeaderProvidedError

Constant Summary collapse

LIVE_URI =
'https://api.auspost.com.au/'
FORMATS =
['json', 'xml']

Instance Method Summary collapse

Methods inherited from Endpoint

#execute, #initialize

Methods included from Endpoint::Attributes

included

Constructor Details

This class inherits a constructor from AusPostAPI::Endpoint

Instance Method Details

#headersObject



15
16
17
# File 'lib/aus_post_api/dce/endpoint.rb', line 15

def headers
  { "Authorization" => "Basic #{basic_auth}" }
end

#uriObject



11
12
13
# File 'lib/aus_post_api/dce/endpoint.rb', line 11

def uri
  "#{LIVE_URI}/#{api_uri}.#{format}?#{params}"
end