Class: UPS::Parsers::RateParser

Inherits:
Object
  • Object
show all
Defined in:
lib/ups/parsers/rate_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rate) ⇒ RateParser

Returns a new instance of RateParser.



9
10
11
# File 'lib/ups/parsers/rate_parser.rb', line 9

def initialize(rate)
  @rate = rate
end

Instance Attribute Details

#rateObject (readonly)

Returns the value of attribute rate.



7
8
9
# File 'lib/ups/parsers/rate_parser.rb', line 7

def rate
  @rate
end

Instance Method Details

#rate_service_codeObject



26
27
28
# File 'lib/ups/parsers/rate_parser.rb', line 26

def rate_service_code
  rate_service[:Code]
end

#rate_service_nameObject



22
23
24
# File 'lib/ups/parsers/rate_parser.rb', line 22

def rate_service_name
  UPS::SERVICES[rate_service_code]
end

#to_hObject



13
14
15
16
17
18
19
20
# File 'lib/ups/parsers/rate_parser.rb', line 13

def to_h
  {
    service_code: rate_service_code,
    service_name: rate_service_name,
    warnings:     rate_warnings,
    total:        rate_total
  }
end