Class: ColorMeShop::Delivery

Inherits:
Object
  • Object
show all
Defined in:
lib/color_me_shop/models/delivery.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Delivery

Initializes the object

Parameters:

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

    Model attributes in the form of hash



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
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
# File 'lib/color_me_shop/models/delivery.rb', line 148

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 }

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

  if attributes.has_key?(:'account_id')
    self. = attributes[:'account_id']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'image_url')
    self.image_url = attributes[:'image_url']
  end

  if attributes.has_key?(:'charge_free_type')
    self.charge_free_type = attributes[:'charge_free_type']
  end

  if attributes.has_key?(:'charge_free_limit')
    self.charge_free_limit = attributes[:'charge_free_limit']
  end

  if attributes.has_key?(:'charge_type')
    self.charge_type = attributes[:'charge_type']
  end

  if attributes.has_key?(:'charge')
    self.charge = attributes[:'charge']
  end

  if attributes.has_key?(:'tax_included')
    self.tax_included = attributes[:'tax_included']
  end

  if attributes.has_key?(:'slip_number_use')
    self.slip_number_use = attributes[:'slip_number_use']
  end

  if attributes.has_key?(:'slip_number_url')
    self.slip_number_url = attributes[:'slip_number_url']
  end

  if attributes.has_key?(:'memo')
    self.memo = attributes[:'memo']
  end

  if attributes.has_key?(:'memo2')
    self.memo2 = attributes[:'memo2']
  end

  if attributes.has_key?(:'sort')
    self.sort = attributes[:'sort']
  end

  if attributes.has_key?(:'display_state')
    self.display_state = attributes[:'display_state']
  end

  if attributes.has_key?(:'preferred_date_use')
    self.preferred_date_use = attributes[:'preferred_date_use']
  end

  if attributes.has_key?(:'preferred_period_use')
    self.preferred_period_use = attributes[:'preferred_period_use']
  end

  if attributes.has_key?(:'make_date')
    self.make_date = attributes[:'make_date']
  end

  if attributes.has_key?(:'update_date')
    self.update_date = attributes[:'update_date']
  end
end

Instance Attribute Details

#account_idObject

ショップアカウントID



21
22
23
# File 'lib/color_me_shop/models/delivery.rb', line 21

def 
  @account_id
end

#chargeObject

配送料設定の詳細。上記の‘charge_free_type`や`charge_type`に基づいて、この中から配送料が決定される



39
40
41
# File 'lib/color_me_shop/models/delivery.rb', line 39

def charge
  @charge
end

#charge_free_limitObject

配送料が無料になる金額。‘charge_free_type`が`free_to_limit`の場合のみ意味を持つ



33
34
35
# File 'lib/color_me_shop/models/delivery.rb', line 33

def charge_free_limit
  @charge_free_limit
end

#charge_free_typeObject

配送料が無料になる基準 - ‘not_free`: 有料 - `free`: 無料 - `free_to_limit`: 注文金額が一定以上の場合は無料



30
31
32
# File 'lib/color_me_shop/models/delivery.rb', line 30

def charge_free_type
  @charge_free_type
end

#charge_typeObject

配送料の計算方法 - ‘fixed`: 固定額 - `by_price`: 注文金額によって決定 - `by_area`: 配送先都道府県によって決定 - `by_weight`: 商品重量によって決定



36
37
38
# File 'lib/color_me_shop/models/delivery.rb', line 36

def charge_type
  @charge_type
end

#display_stateObject

表示状態



60
61
62
# File 'lib/color_me_shop/models/delivery.rb', line 60

def display_state
  @display_state
end

#idObject

配送方法ID



18
19
20
# File 'lib/color_me_shop/models/delivery.rb', line 18

def id
  @id
end

#image_urlObject

配送方法画像URL



27
28
29
# File 'lib/color_me_shop/models/delivery.rb', line 27

def image_url
  @image_url
end

#make_dateObject

配送方法作成日時



69
70
71
# File 'lib/color_me_shop/models/delivery.rb', line 69

def make_date
  @make_date
end

#memoObject

配送方法の説明



51
52
53
# File 'lib/color_me_shop/models/delivery.rb', line 51

def memo
  @memo
end

#memo2Object

フィーチャーフォン向けショップ用の配送方法説明



54
55
56
# File 'lib/color_me_shop/models/delivery.rb', line 54

def memo2
  @memo2
end

#nameObject

配送方法名



24
25
26
# File 'lib/color_me_shop/models/delivery.rb', line 24

def name
  @name
end

#preferred_date_useObject

配送希望日を指定可能か



63
64
65
# File 'lib/color_me_shop/models/delivery.rb', line 63

def preferred_date_use
  @preferred_date_use
end

#preferred_period_useObject

配送時間帯を指定可能か



66
67
68
# File 'lib/color_me_shop/models/delivery.rb', line 66

def preferred_period_use
  @preferred_period_use
end

#slip_number_urlObject

配送伝票番号確認URL



48
49
50
# File 'lib/color_me_shop/models/delivery.rb', line 48

def slip_number_url
  @slip_number_url
end

#slip_number_useObject

配送伝票番号設定を使用するか否か



45
46
47
# File 'lib/color_me_shop/models/delivery.rb', line 45

def slip_number_use
  @slip_number_use
end

#sortObject

表示順



57
58
59
# File 'lib/color_me_shop/models/delivery.rb', line 57

def sort
  @sort
end

#tax_includedObject

送料が税込み料金であるか否か



42
43
44
# File 'lib/color_me_shop/models/delivery.rb', line 42

def tax_included
  @tax_included
end

#update_dateObject

配送方法更新日時



72
73
74
# File 'lib/color_me_shop/models/delivery.rb', line 72

def update_date
  @update_date
end

Class Method Details

.attribute_mapObject

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



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/color_me_shop/models/delivery.rb', line 97

def self.attribute_map
  {
    :'id' => :'id',
    :'account_id' => :'account_id',
    :'name' => :'name',
    :'image_url' => :'image_url',
    :'charge_free_type' => :'charge_free_type',
    :'charge_free_limit' => :'charge_free_limit',
    :'charge_type' => :'charge_type',
    :'charge' => :'charge',
    :'tax_included' => :'tax_included',
    :'slip_number_use' => :'slip_number_use',
    :'slip_number_url' => :'slip_number_url',
    :'memo' => :'memo',
    :'memo2' => :'memo2',
    :'sort' => :'sort',
    :'display_state' => :'display_state',
    :'preferred_date_use' => :'preferred_date_use',
    :'preferred_period_use' => :'preferred_period_use',
    :'make_date' => :'make_date',
    :'update_date' => :'update_date'
  }
end

.openapi_typesObject

Attribute type mapping.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/color_me_shop/models/delivery.rb', line 122

def self.openapi_types
  {
    :'id' => :'Integer',
    :'account_id' => :'String',
    :'name' => :'String',
    :'image_url' => :'String',
    :'charge_free_type' => :'String',
    :'charge_free_limit' => :'Integer',
    :'charge_type' => :'String',
    :'charge' => :'Object',
    :'tax_included' => :'BOOLEAN',
    :'slip_number_use' => :'BOOLEAN',
    :'slip_number_url' => :'String',
    :'memo' => :'String',
    :'memo2' => :'String',
    :'sort' => :'Integer',
    :'display_state' => :'String',
    :'preferred_date_use' => :'BOOLEAN',
    :'preferred_period_use' => :'BOOLEAN',
    :'make_date' => :'Integer',
    :'update_date' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/color_me_shop/models/delivery.rb', line 282

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
       == o. &&
      name == o.name &&
      image_url == o.image_url &&
      charge_free_type == o.charge_free_type &&
      charge_free_limit == o.charge_free_limit &&
      charge_type == o.charge_type &&
      charge == o.charge &&
      tax_included == o.tax_included &&
      slip_number_use == o.slip_number_use &&
      slip_number_url == o.slip_number_url &&
      memo == o.memo &&
      memo2 == o.memo2 &&
      sort == o.sort &&
      display_state == o.display_state &&
      preferred_date_use == o.preferred_date_use &&
      preferred_period_use == o.preferred_period_use &&
      make_date == o.make_date &&
      update_date == o.update_date
end

#_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



342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/color_me_shop/models/delivery.rb', line 342

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 = ColorMeShop.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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



408
409
410
411
412
413
414
415
416
417
418
419
420
# File 'lib/color_me_shop/models/delivery.rb', line 408

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/color_me_shop/models/delivery.rb', line 321

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


308
309
310
# File 'lib/color_me_shop/models/delivery.rb', line 308

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



314
315
316
# File 'lib/color_me_shop/models/delivery.rb', line 314

def hash
  [id, , name, image_url, charge_free_type, charge_free_limit, charge_type, charge, tax_included, slip_number_use, slip_number_url, memo, memo2, sort, display_state, preferred_date_use, preferred_period_use, make_date, update_date].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



233
234
235
236
# File 'lib/color_me_shop/models/delivery.rb', line 233

def list_invalid_properties
  invalid_properties = Array.new
  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



388
389
390
# File 'lib/color_me_shop/models/delivery.rb', line 388

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



394
395
396
397
398
399
400
401
402
# File 'lib/color_me_shop/models/delivery.rb', line 394

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



382
383
384
# File 'lib/color_me_shop/models/delivery.rb', line 382

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



240
241
242
243
244
245
246
247
248
# File 'lib/color_me_shop/models/delivery.rb', line 240

def valid?
  charge_free_type_validator = EnumAttributeValidator.new('String', ['not_free', 'free', 'free_to_limit'])
  return false unless charge_free_type_validator.valid?(@charge_free_type)
  charge_type_validator = EnumAttributeValidator.new('String', ['fixed', 'by_price', 'by_area', 'by_weight'])
  return false unless charge_type_validator.valid?(@charge_type)
  display_state_validator = EnumAttributeValidator.new('String', ['showing', 'hidden'])
  return false unless display_state_validator.valid?(@display_state)
  true
end