Class: FedexRateGetter::Rate

Inherits:
Object
  • Object
show all
Defined in:
lib/fedex_rate_getter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRate

Returns a new instance of Rate.



10
11
12
# File 'lib/fedex_rate_getter.rb', line 10

def initialize
  @something = 'hola mundo'
end

Instance Attribute Details

#somethingObject

Returns the value of attribute something.



8
9
10
# File 'lib/fedex_rate_getter.rb', line 8

def something
  @something
end

Class Method Details

.get(credentials, quote_params) ⇒ Array

Main method. returns shipping rate

Returns:

  • (Array)

    array of requested rates



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fedex_rate_getter.rb', line 17

def self.get(credentials, quote_params)
  # enable the api connection
  connection = FedexRateGetter::Connection.new

  # format body
  body = FedexRateGetter::Formatter::Body.new(credentials, quote_params).body

  # make a call to the api
  res = connection.get_rates(body)

  # return
  FedexRateGetter::Formatter::Response.new(res.body).response
end