Class: ZSGFClient::GeoLocationResponseModel

Inherits:
Object
  • Object
show all
Defined in:
lib/zsgf_client/models/geo_location_response_model.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GeoLocationResponseModel

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 174

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `ZSGFClient::GeoLocationResponseModel` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `ZSGFClient::GeoLocationResponseModel`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'location_name')
    self.location_name = attributes[:'location_name']
  end

  if attributes.key?(:'latitude')
    self.latitude = attributes[:'latitude']
  else
    self.latitude = nil
  end

  if attributes.key?(:'longitude')
    self.longitude = attributes[:'longitude']
  else
    self.longitude = nil
  end

  if attributes.key?(:'location_type')
    self.location_type = attributes[:'location_type']
  else
    self.location_type = nil
  end

  if attributes.key?(:'recipient_name')
    self.recipient_name = attributes[:'recipient_name']
  end

  if attributes.key?(:'phone_number')
    self.phone_number = attributes[:'phone_number']
  end

  if attributes.key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.key?(:'country')
    self.country = attributes[:'country']
  end

  if attributes.key?(:'state')
    self.state = attributes[:'state']
  end

  if attributes.key?(:'city')
    self.city = attributes[:'city']
  end

  if attributes.key?(:'district')
    self.district = attributes[:'district']
  end

  if attributes.key?(:'street')
    self.street = attributes[:'street']
  end

  if attributes.key?(:'zip_code')
    self.zip_code = attributes[:'zip_code']
  end

  if attributes.key?(:'address')
    self.address = attributes[:'address']
  end

  if attributes.key?(:'map_type')
    self.map_type = attributes[:'map_type']
  end

  if attributes.key?(:'remark')
    self.remark = attributes[:'remark']
  end

  if attributes.key?(:'tags')
    self.tags = attributes[:'tags']
  end

  if attributes.key?(:'enable')
    self.enable = attributes[:'enable']
  end

  if attributes.key?(:'show_index')
    self.show_index = attributes[:'show_index']
  end

  if attributes.key?(:'create_date')
    self.create_date = attributes[:'create_date']
  end

  if attributes.key?(:'last_update')
    self.last_update = attributes[:'last_update']
  end

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end
end

Instance Attribute Details

#addressObject

详细的地址信息



58
59
60
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 58

def address
  @address
end

#cityObject

城市



46
47
48
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 46

def city
  @city
end

#countryObject

国家



40
41
42
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 40

def country
  @country
end

#create_dateObject

创建时间



76
77
78
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 76

def create_date
  @create_date
end

#districtObject

区/县



49
50
51
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 49

def district
  @district
end

#emailObject

收货人电子邮件



37
38
39
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 37

def email
  @email
end

#enableObject

启用



70
71
72
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 70

def enable
  @enable
end

#idObject

ID



82
83
84
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 82

def id
  @id
end

#last_updateObject

最后更新的时间



79
80
81
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 79

def last_update
  @last_update
end

#latitudeObject

纬度



22
23
24
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 22

def latitude
  @latitude
end

#location_nameObject

地点的名称



19
20
21
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 19

def location_name
  @location_name
end

#location_typeObject

地点的类型,如家庭、工作、学校等



28
29
30
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 28

def location_type
  @location_type
end

#longitudeObject

经度



25
26
27
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 25

def longitude
  @longitude
end

#map_typeObject

地址类型,百度、高德、谷歌



61
62
63
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 61

def map_type
  @map_type
end

#phone_numberObject

收货人联系电话



34
35
36
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 34

def phone_number
  @phone_number
end

#recipient_nameObject

收货人姓名



31
32
33
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 31

def recipient_name
  @recipient_name
end

#remarkObject

备注



64
65
66
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 64

def remark
  @remark
end

#show_indexObject

排序



73
74
75
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 73

def show_index
  @show_index
end

#stateObject

州/省



43
44
45
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 43

def state
  @state
end

#streetObject

街道



52
53
54
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 52

def street
  @street
end

#tagsObject

标签



67
68
69
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 67

def tags
  @tags
end

#zip_codeObject

邮政编码



55
56
57
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 55

def zip_code
  @zip_code
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 609

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.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
    # models (e.g. Pet) or oneOf
    klass = ZSGFClient.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



113
114
115
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 113

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



118
119
120
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 118

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 85

def self.attribute_map
  {
    :'location_name' => :'locationName',
    :'latitude' => :'latitude',
    :'longitude' => :'longitude',
    :'location_type' => :'locationType',
    :'recipient_name' => :'recipientName',
    :'phone_number' => :'phoneNumber',
    :'email' => :'email',
    :'country' => :'country',
    :'state' => :'state',
    :'city' => :'city',
    :'district' => :'district',
    :'street' => :'street',
    :'zip_code' => :'zipCode',
    :'address' => :'address',
    :'map_type' => :'mapType',
    :'remark' => :'remark',
    :'tags' => :'tags',
    :'enable' => :'enable',
    :'show_index' => :'showIndex',
    :'create_date' => :'createDate',
    :'last_update' => :'lastUpdate',
    :'id' => :'id'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 585

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 151

def self.openapi_nullable
  Set.new([
    :'location_name',
    :'recipient_name',
    :'phone_number',
    :'email',
    :'country',
    :'state',
    :'city',
    :'district',
    :'street',
    :'zip_code',
    :'address',
    :'map_type',
    :'remark',
    :'tags',
    :'enable',
    :'show_index',
  ])
end

.openapi_typesObject

Attribute type mapping.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 123

def self.openapi_types
  {
    :'location_name' => :'String',
    :'latitude' => :'Float',
    :'longitude' => :'Float',
    :'location_type' => :'String',
    :'recipient_name' => :'String',
    :'phone_number' => :'String',
    :'email' => :'String',
    :'country' => :'String',
    :'state' => :'String',
    :'city' => :'String',
    :'district' => :'String',
    :'street' => :'String',
    :'zip_code' => :'String',
    :'address' => :'String',
    :'map_type' => :'String',
    :'remark' => :'String',
    :'tags' => :'String',
    :'enable' => :'Boolean',
    :'show_index' => :'Integer',
    :'create_date' => :'Time',
    :'last_update' => :'Time',
    :'id' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 543

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      location_name == o.location_name &&
      latitude == o.latitude &&
      longitude == o.longitude &&
      location_type == o.location_type &&
      recipient_name == o.recipient_name &&
      phone_number == o.phone_number &&
      email == o.email &&
      country == o.country &&
      state == o.state &&
      city == o.city &&
      district == o.district &&
      street == o.street &&
      zip_code == o.zip_code &&
      address == o.address &&
      map_type == o.map_type &&
      remark == o.remark &&
      tags == o.tags &&
      enable == o.enable &&
      show_index == o.show_index &&
      create_date == o.create_date &&
      last_update == o.last_update &&
      id == o.id
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



680
681
682
683
684
685
686
687
688
689
690
691
692
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 680

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


572
573
574
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 572

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



578
579
580
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 578

def hash
  [location_name, latitude, longitude, location_type, recipient_name, phone_number, email, country, state, city, district, street, zip_code, address, map_type, remark, tags, enable, show_index, create_date, last_update, id].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 285

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@location_name.nil? && @location_name.to_s.length > 50
    invalid_properties.push('invalid value for "location_name", the character length must be smaller than or equal to 50.')
  end

  if @latitude.nil?
    invalid_properties.push('invalid value for "latitude", latitude cannot be nil.')
  end

  if @longitude.nil?
    invalid_properties.push('invalid value for "longitude", longitude cannot be nil.')
  end

  if @location_type.nil?
    invalid_properties.push('invalid value for "location_type", location_type cannot be nil.')
  end

  if @location_type.to_s.length > 20
    invalid_properties.push('invalid value for "location_type", the character length must be smaller than or equal to 20.')
  end

  if @location_type.to_s.length < 1
    invalid_properties.push('invalid value for "location_type", the character length must be great than or equal to 1.')
  end

  if !@recipient_name.nil? && @recipient_name.to_s.length > 50
    invalid_properties.push('invalid value for "recipient_name", the character length must be smaller than or equal to 50.')
  end

  if !@country.nil? && @country.to_s.length > 20
    invalid_properties.push('invalid value for "country", the character length must be smaller than or equal to 20.')
  end

  if !@state.nil? && @state.to_s.length > 20
    invalid_properties.push('invalid value for "state", the character length must be smaller than or equal to 20.')
  end

  if !@city.nil? && @city.to_s.length > 20
    invalid_properties.push('invalid value for "city", the character length must be smaller than or equal to 20.')
  end

  if !@district.nil? && @district.to_s.length > 50
    invalid_properties.push('invalid value for "district", the character length must be smaller than or equal to 50.')
  end

  if !@street.nil? && @street.to_s.length > 255
    invalid_properties.push('invalid value for "street", the character length must be smaller than or equal to 255.')
  end

  if !@zip_code.nil? && @zip_code.to_s.length > 20
    invalid_properties.push('invalid value for "zip_code", the character length must be smaller than or equal to 20.')
  end

  if !@address.nil? && @address.to_s.length > 1000
    invalid_properties.push('invalid value for "address", the character length must be smaller than or equal to 1000.')
  end

  if !@map_type.nil? && @map_type.to_s.length > 20
    invalid_properties.push('invalid value for "map_type", the character length must be smaller than or equal to 20.')
  end

  if !@remark.nil? && @remark.to_s.length > 5000
    invalid_properties.push('invalid value for "remark", the character length must be smaller than or equal to 5000.')
  end

  if !@tags.nil? && @tags.to_s.length > 1000
    invalid_properties.push('invalid value for "tags", the character length must be smaller than or equal to 1000.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



656
657
658
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 656

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



662
663
664
665
666
667
668
669
670
671
672
673
674
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 662

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



650
651
652
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 650

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/zsgf_client/models/geo_location_response_model.rb', line 361

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@location_name.nil? && @location_name.to_s.length > 50
  return false if @latitude.nil?
  return false if @longitude.nil?
  return false if @location_type.nil?
  return false if @location_type.to_s.length > 20
  return false if @location_type.to_s.length < 1
  return false if !@recipient_name.nil? && @recipient_name.to_s.length > 50
  return false if !@country.nil? && @country.to_s.length > 20
  return false if !@state.nil? && @state.to_s.length > 20
  return false if !@city.nil? && @city.to_s.length > 20
  return false if !@district.nil? && @district.to_s.length > 50
  return false if !@street.nil? && @street.to_s.length > 255
  return false if !@zip_code.nil? && @zip_code.to_s.length > 20
  return false if !@address.nil? && @address.to_s.length > 1000
  return false if !@map_type.nil? && @map_type.to_s.length > 20
  return false if !@remark.nil? && @remark.to_s.length > 5000
  return false if !@tags.nil? && @tags.to_s.length > 1000
  true
end