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(city = nil, country = nil, country_code = nil, latitude = nil, line_1 = nil, line_2 = nil, longitude = nil, postal_code = nil, province = nil, state = 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(city = nil,
               country = nil,
               country_code = nil,
               latitude = nil,
               line_1 = nil,
               line_2 = nil,
               longitude = nil,
               postal_code = nil,
               province = nil,
               state = nil)
  @city = city
  @country = country
  @country_code = country_code
  @latitude = latitude
  @line_1 = line_1
  @line_2 = line_2
  @longitude = longitude
  @postal_code = postal_code
  @province = province
  @state = state
end

Instance Attribute Details

#cityString

city of Address

Returns:



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

def city
  @city
end

#countryString

country of Address

Returns:



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

def country
  @country
end

#country_codeString

country code of Address

Returns:



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

def country_code
  @country_code
end

#latitudeString

latitude of Address

Returns:



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

def latitude
  @latitude
end

#line_1String

line 1 of Address

Returns:



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

def line_1
  @line_1
end

#line_2String

line 2 of Address

Returns:



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

def line_2
  @line_2
end

#longitudeString

longitude of Address

Returns:



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

def longitude
  @longitude
end

#postal_codeString

postal code of Address

Returns:



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

def postal_code
  @postal_code
end

#provinceString

province of Address

Returns:



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

def province
  @province
end

#stateString

state of Address

Returns:



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

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
113
114
# File 'lib/gonebusy/models/entities_address_entity.rb', line 86

def self.from_hash(hash)
  if hash == nil
    nil
  else
    # Extract variables from the hash

    city = hash["city"]
    country = hash["country"]
    country_code = hash["country_code"]
    latitude = hash["latitude"]
    line_1 = hash["line1"]
    line_2 = hash["line2"]
    longitude = hash["longitude"]
    postal_code = hash["postal_code"]
    province = hash["province"]
    state = hash["state"]

    # Create object from extracted values

    EntitiesAddressEntity.new(city,
                              country,
                              country_code,
                              latitude,
                              line_1,
                              line_2,
                              longitude,
                              postal_code,
                              province,
                              state)
  end
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["city"] = "city"
    @hash["country"] = "country"
    @hash["country_code"] = "country_code"
    @hash["latitude"] = "latitude"
    @hash["line_1"] = "line1"
    @hash["line_2"] = "line2"
    @hash["longitude"] = "longitude"
    @hash["postal_code"] = "postal_code"
    @hash["province"] = "province"
    @hash["state"] = "state"
  end
  @hash
end