Class: Workarea::Listrak::Models::Address

Inherits:
Object
  • Object
show all
Defined in:
app/services/workarea/listrak/models/address.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workarea_address) ⇒ Address

Returns a new instance of Address.



7
8
9
# File 'app/services/workarea/listrak/models/address.rb', line 7

def initialize(workarea_address)
  @workarea_address = workarea_address
end

Instance Attribute Details

#workarea_addressObject (readonly)

Returns the value of attribute workarea_address.



5
6
7
# File 'app/services/workarea/listrak/models/address.rb', line 5

def workarea_address
  @workarea_address
end

Instance Method Details

#address1String

Home address line 1

limited to 100 characters

Returns:

  • (String)


28
29
30
# File 'app/services/workarea/listrak/models/address.rb', line 28

def address1
  workarea_address.street.to_s[0...100]
end

#address2String

Home address line 2

limited to 100 characters

Returns:

  • (String)


38
39
40
# File 'app/services/workarea/listrak/models/address.rb', line 38

def address2
  workarea_address.street_2.to_s[0..100]
end

#address3String

Home address line 3

limited to 100 characters

Returns:

  • (String)


48
49
# File 'app/services/workarea/listrak/models/address.rb', line 48

def address3
end

#as_jsonObject



11
12
13
14
15
16
17
18
19
20
# File 'app/services/workarea/listrak/models/address.rb', line 11

def as_json
  {
    address1: address1,
    address2: address2,
    address3: address3,
    city: city,
    country: country,
    state: state
  }.compact
end

#cityString

Home address city

limited to 100 characters

Returns:

  • (String)


57
58
59
# File 'app/services/workarea/listrak/models/address.rb', line 57

def city
  workarea_address.city.to_s[0...100]
end

#countryString

Home address country

limited to 100 characters

Returns:

  • (String)


67
68
69
# File 'app/services/workarea/listrak/models/address.rb', line 67

def country
  workarea_address.country.name[0...100]
end

#stateString

Home address state

limited to 100 characters

Returns:

  • (String)


77
78
79
# File 'app/services/workarea/listrak/models/address.rb', line 77

def state
  workarea_address.region.to_s[0...100]
end