Class: Deliveree::Location
- Inherits:
-
Object
- Object
- Deliveree::Location
- Defined in:
- lib/deliveree_client/models/location.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#cod_invoice_fees ⇒ Object
Returns the value of attribute cod_invoice_fees.
-
#cod_note ⇒ Object
Returns the value of attribute cod_note.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#need_cod ⇒ Object
Returns the value of attribute need_cod.
-
#need_pod ⇒ Object
Returns the value of attribute need_pod.
-
#note ⇒ Object
Returns the value of attribute note.
-
#pod_note ⇒ Object
Returns the value of attribute pod_note.
-
#position_trackings ⇒ Object
Returns the value of attribute position_trackings.
-
#recipient_name ⇒ Object
Returns the value of attribute recipient_name.
-
#recipient_phone ⇒ Object
Returns the value of attribute recipient_phone.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.attribute_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Location
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Location
Initializes the object
73 74 75 76 77 78 79 80 81 82 83 84 85 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 115 116 117 118 119 120 121 |
# File 'lib/deliveree_client/models/location.rb', line 73 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } # To make sure attribute mandatory self.address = attributes[:'address'] self.latitude = attributes[:'latitude'] self.longitude = attributes[:'longitude'] if attributes.has_key?(:'recipient_name') self.recipient_name = attributes[:'recipient_name'] end if attributes.has_key?(:'recipient_phone') self.recipient_phone = attributes[:'recipient_phone'] end if attributes.has_key?(:'note') self.note = attributes[:'note'] end if attributes.has_key?(:'need_cod') self.need_cod = attributes[:'need_cod'] end if attributes.has_key?(:'cod_note') self.cod_note = attributes[:'cod_note'] end if attributes.has_key?(:'cod_invoice_fees') self.cod_invoice_fees = attributes[:'cod_invoice_fees'] end if attributes.has_key?(:'need_pod') self.need_pod = attributes[:'need_pod'] end if attributes.has_key?(:'pod_note') self.pod_note = attributes[:'pod_note'] end if attributes.has_key?(:'position_trackings') if (value = attributes[:'position_trackings']).is_a?(Array) self.position_trackings = value end end end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
11 12 13 |
# File 'lib/deliveree_client/models/location.rb', line 11 def address @address end |
#cod_invoice_fees ⇒ Object
Returns the value of attribute cod_invoice_fees.
27 28 29 |
# File 'lib/deliveree_client/models/location.rb', line 27 def cod_invoice_fees @cod_invoice_fees end |
#cod_note ⇒ Object
Returns the value of attribute cod_note.
25 26 27 |
# File 'lib/deliveree_client/models/location.rb', line 25 def cod_note @cod_note end |
#latitude ⇒ Object
Returns the value of attribute latitude.
13 14 15 |
# File 'lib/deliveree_client/models/location.rb', line 13 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
15 16 17 |
# File 'lib/deliveree_client/models/location.rb', line 15 def longitude @longitude end |
#need_cod ⇒ Object
Returns the value of attribute need_cod.
23 24 25 |
# File 'lib/deliveree_client/models/location.rb', line 23 def need_cod @need_cod end |
#need_pod ⇒ Object
Returns the value of attribute need_pod.
29 30 31 |
# File 'lib/deliveree_client/models/location.rb', line 29 def need_pod @need_pod end |
#note ⇒ Object
Returns the value of attribute note.
21 22 23 |
# File 'lib/deliveree_client/models/location.rb', line 21 def note @note end |
#pod_note ⇒ Object
Returns the value of attribute pod_note.
31 32 33 |
# File 'lib/deliveree_client/models/location.rb', line 31 def pod_note @pod_note end |
#position_trackings ⇒ Object
Returns the value of attribute position_trackings.
33 34 35 |
# File 'lib/deliveree_client/models/location.rb', line 33 def position_trackings @position_trackings end |
#recipient_name ⇒ Object
Returns the value of attribute recipient_name.
17 18 19 |
# File 'lib/deliveree_client/models/location.rb', line 17 def recipient_name @recipient_name end |
#recipient_phone ⇒ Object
Returns the value of attribute recipient_phone.
19 20 21 |
# File 'lib/deliveree_client/models/location.rb', line 19 def recipient_phone @recipient_phone end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/deliveree_client/models/location.rb', line 36 def self.attribute_map { :'address' => :'address', :'latitude' => :'latitude', :'longitude' => :'longitude', :'recipient_name' => :'recipient_name', :'recipient_phone' => :'recipient_phone', :'note' => :'note', :'need_cod' => :'need_cod', :'cod_note' => :'cod_note', :'cod_invoice_fees' => :'cod_invoice_fees', :'need_pod' => :'need_pod', :'pod_note' => :'pod_note', :'position_trackings' => :'position_trackings' } end |
.attribute_types ⇒ Object
Attribute type mapping.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/deliveree_client/models/location.rb', line 54 def self.attribute_types { :'address' => :'String', :'latitude' => :'Float', :'longitude' => :'Float', :'recipient_name' => :'String', :'recipient_phone' => :'String', :'note' => :'String', :'need_cod' => :'BOOLEAN', :'cod_note' => :'String', :'cod_invoice_fees' => :'Float', :'need_pod' => :'BOOLEAN', :'pod_note' => :'String', :'position_trackings' => :'Array<PositionTracking>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/deliveree_client/models/location.rb', line 138 def ==(o) return true if self.equal?(o) self.class == o.class && address == o.address && latitude == o.latitude && longitude == o.longitude && recipient_name == o.recipient_name && recipient_phone == o.recipient_phone && note == o.note && need_cod == o.need_cod && cod_note == o.cod_note && cod_invoice_fees == o.cod_invoice_fees && need_pod == o.need_pod && pod_note == o.pod_note && position_trackings == o.position_trackings end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/deliveree_client/models/location.rb', line 191 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = Deliveree.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/deliveree_client/models/location.rb', line 257 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/deliveree_client/models/location.rb', line 170 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.attribute_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
157 158 159 |
# File 'lib/deliveree_client/models/location.rb', line 157 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
163 164 165 |
# File 'lib/deliveree_client/models/location.rb', line 163 def hash [address, latitude, longitude, recipient_name, recipient_phone, note, need_cod, cod_note, cod_invoice_fees, need_pod, pod_note, position_trackings].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
125 126 127 128 |
# File 'lib/deliveree_client/models/location.rb', line 125 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
237 238 239 |
# File 'lib/deliveree_client/models/location.rb', line 237 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
243 244 245 246 247 248 249 250 251 |
# File 'lib/deliveree_client/models/location.rb', line 243 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
231 232 233 |
# File 'lib/deliveree_client/models/location.rb', line 231 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
132 133 134 |
# File 'lib/deliveree_client/models/location.rb', line 132 def valid? true end |