Class: Gonebusy::EntitiesAddressEntity

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/gonebusy/models/entities_address_entity.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(line_1 = nil, line_2 = nil, city = nil, state = nil, province = nil, postal_code = nil, country = nil, country_code = nil, latitude = nil, longitude = nil) ⇒ EntitiesAddressEntity

Returns a new instance of EntitiesAddressEntity.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/gonebusy/models/entities_address_entity.rb', line 63

def initialize(line_1 = nil,
               line_2 = nil,
               city = nil,
               state = nil,
               province = nil,
               postal_code = nil,
               country = nil,
               country_code = nil,
               latitude = nil,
               longitude = nil)
  @line_1 = line_1
  @line_2 = line_2
  @city = city
  @state = state
  @province = province
  @postal_code = postal_code
  @country = country
  @country_code = country_code
  @latitude = latitude
  @longitude = longitude
end

Instance Attribute Details

#cityString

city of Address

Returns:



15
16
17
# File 'lib/gonebusy/models/entities_address_entity.rb', line 15

def city
  @city
end

#countryString

country of Address

Returns:



31
32
33
# File 'lib/gonebusy/models/entities_address_entity.rb', line 31

def country
  @country
end

#country_codeString

country code of Address

Returns:



35
36
37
# File 'lib/gonebusy/models/entities_address_entity.rb', line 35

def country_code
  @country_code
end

#latitudeString

latitude of Address

Returns:



39
40
41
# File 'lib/gonebusy/models/entities_address_entity.rb', line 39

def latitude
  @latitude
end

#line_1String

line 1 of Address

Returns:



7
8
9
# File 'lib/gonebusy/models/entities_address_entity.rb', line 7

def line_1
  @line_1
end

#line_2String

line 2 of Address

Returns:



11
12
13
# File 'lib/gonebusy/models/entities_address_entity.rb', line 11

def line_2
  @line_2
end

#longitudeString

longitude of Address

Returns:



43
44
45
# File 'lib/gonebusy/models/entities_address_entity.rb', line 43

def longitude
  @longitude
end

#postal_codeString

postal code of Address

Returns:



27
28
29
# File 'lib/gonebusy/models/entities_address_entity.rb', line 27

def postal_code
  @postal_code
end

#provinceString

province of Address

Returns:



23
24
25
# File 'lib/gonebusy/models/entities_address_entity.rb', line 23

def province
  @province
end

#stateString

state of Address

Returns:



19
20
21
# File 'lib/gonebusy/models/entities_address_entity.rb', line 19

def state
  @state
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/gonebusy/models/entities_address_entity.rb', line 86

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash
  line_1 = hash['line1']
  line_2 = hash['line2']
  city = hash['city']
  state = hash['state']
  province = hash['province']
  postal_code = hash['postal_code']
  country = hash['country']
  country_code = hash['country_code']
  latitude = hash['latitude']
  longitude = hash['longitude']

  # Create object from extracted values
  EntitiesAddressEntity.new(line_1,
                            line_2,
                            city,
                            state,
                            province,
                            postal_code,
                            country,
                            country_code,
                            latitude,
                            longitude)
end

.namesObject

A mapping from model property names to API property names



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/gonebusy/models/entities_address_entity.rb', line 46

def self.names
  if @_hash.nil?
    @_hash = {}
    @_hash["line_1"] = "line1"
    @_hash["line_2"] = "line2"
    @_hash["city"] = "city"
    @_hash["state"] = "state"
    @_hash["province"] = "province"
    @_hash["postal_code"] = "postal_code"
    @_hash["country"] = "country"
    @_hash["country_code"] = "country_code"
    @_hash["latitude"] = "latitude"
    @_hash["longitude"] = "longitude"
  end
  @_hash
end