Class: Fedex::Address

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Address

Returns a new instance of Address.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fedex/address.rb', line 8

def initialize(options)
  @changes   = options[:changes]
  @score     = options[:score].to_i
  @confirmed = options[:delivery_point_validation] == "CONFIRMED"
  @available = options[:delivery_point_validation] != "UNAVAILABLE"

  @status      = options[:residential_status]
  @residential = status == "RESIDENTIAL"
  @business    = status == "BUSINESS"

  address        = options[:address]

  @company       = options[:company_name]
  @street_lines  = address[:street_lines]
  @city          = address[:city]
  @state         = address[:state_or_province_code]
  @province_code = address[:state_or_province_code]
  @postal_code   = address[:postal_code]
  @country_code  = address[:country_code]

  @options = options
end

Instance Attribute Details

#availableObject (readonly)

Returns the value of attribute available.



4
5
6
# File 'lib/fedex/address.rb', line 4

def available
  @available
end

#businessObject (readonly)

Returns the value of attribute business.



4
5
6
# File 'lib/fedex/address.rb', line 4

def business
  @business
end

#changesObject (readonly)

Returns the value of attribute changes.



4
5
6
# File 'lib/fedex/address.rb', line 4

def changes
  @changes
end

#cityObject (readonly)

Returns the value of attribute city.



4
5
6
# File 'lib/fedex/address.rb', line 4

def city
  @city
end

#companyObject (readonly)

Returns the value of attribute company.



4
5
6
# File 'lib/fedex/address.rb', line 4

def company
  @company
end

#confirmedObject (readonly)

Returns the value of attribute confirmed.



4
5
6
# File 'lib/fedex/address.rb', line 4

def confirmed
  @confirmed
end

#country_codeObject (readonly)

Returns the value of attribute country_code.



4
5
6
# File 'lib/fedex/address.rb', line 4

def country_code
  @country_code
end

#postal_codeObject (readonly)

Returns the value of attribute postal_code.



4
5
6
# File 'lib/fedex/address.rb', line 4

def postal_code
  @postal_code
end

#province_codeObject (readonly)

Returns the value of attribute province_code.



4
5
6
# File 'lib/fedex/address.rb', line 4

def province_code
  @province_code
end

#residentialObject (readonly)

Returns the value of attribute residential.



4
5
6
# File 'lib/fedex/address.rb', line 4

def residential
  @residential
end

#scoreObject (readonly)

Returns the value of attribute score.



4
5
6
# File 'lib/fedex/address.rb', line 4

def score
  @score
end

#stateObject (readonly)

Returns the value of attribute state.



4
5
6
# File 'lib/fedex/address.rb', line 4

def state
  @state
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/fedex/address.rb', line 4

def status
  @status
end

#street_linesObject (readonly)

Returns the value of attribute street_lines.



4
5
6
# File 'lib/fedex/address.rb', line 4

def street_lines
  @street_lines
end