Class: AnPostReturn::Client
- Inherits:
-
Object
- Object
- AnPostReturn::Client
- Defined in:
- lib/an_post_return/client.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #return_labels ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
12 13 14 |
# File 'lib/an_post_return/client.rb', line 12 def initialize @config = AnPostReturn.configuration end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/an_post_return/client.rb', line 10 def config @config end |
Instance Method Details
#connection ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/an_post_return/client.rb', line 20 def connection @connection ||= Faraday.new(url: config.api_base_url) do |faraday| faraday.proxy = config.proxy_uri if config.proxy_configured? faraday.request :json faraday.response :json faraday.adapter Faraday.default_adapter faraday.headers = default_headers end end |
#return_labels ⇒ Object
16 17 18 |
# File 'lib/an_post_return/client.rb', line 16 def return_labels @return_labels ||= Resources::ReturnLabelResource.new(self) end |