Class: FedexRateGetter::Connection
- Inherits:
-
Object
- Object
- FedexRateGetter::Connection
- Defined in:
- lib/fedex_rate_getter/connection.rb
Constant Summary collapse
- API_URL =
'https://wsbeta.fedex.com:443/xml'
Instance Attribute Summary collapse
-
#api_connection ⇒ Object
Returns the value of attribute api_connection.
Instance Method Summary collapse
- #get_rates(body) ⇒ Object
-
#initialize ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize ⇒ Connection
Returns a new instance of Connection.
9 10 11 |
# File 'lib/fedex_rate_getter/connection.rb', line 9 def initialize @api_connection = Faraday.new(API_URL) end |
Instance Attribute Details
#api_connection ⇒ Object
Returns the value of attribute api_connection.
7 8 9 |
# File 'lib/fedex_rate_getter/connection.rb', line 7 def api_connection @api_connection end |
Instance Method Details
#get_rates(body) ⇒ Object
13 14 15 |
# File 'lib/fedex_rate_getter/connection.rb', line 13 def get_rates(body) api_connection.post(API_URL, body, 'Content-Type' => 'application/xml') end |