Class: MfkOpenapiRubyClient::Destination

Inherits:
Object
  • Object
show all
Defined in:
lib/mfk_openapi_ruby_client/models/destination.rb

Overview

請求先です。一つの顧客に対して複数作成することができます。請求先の情報を利用して請求書送付を行います。 <aside class="info">請求先は更新ができません。更新したい場合は新規登録をしてご利用ください。</aside>

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Destination

Initializes the object



141
142
143
144
145
146
147
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
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 141

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

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

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

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

  if attributes.key?(:'cc_emails')
    if (value = attributes[:'cc_emails']).is_a?(Array)
      self.cc_emails = value
    end
  end

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#address1Object

都道府県・市区町村・番地です。必ず都道府県名から始めてください。



20
21
22
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 20

def address1
  @address1
end

#address2Object

建物名・部屋番号などです。



23
24
25
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 23

def address2
  @address2
end

#cc_emailsObject

CCメールアドレスです。最大4件まで登録できます。



26
27
28
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 26

def cc_emails
  @cc_emails
end

#created_atObject

請求先が登録された日時を示します。



29
30
31
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 29

def created_at
  @created_at
end

#customer_idObject

顧客IDです。一意の識別子として自動で付与されます。



32
33
34
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 32

def customer_id
  @customer_id
end

#departmentObject

担当者の部署名です。



35
36
37
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 35

def department
  @department
end

#emailObject

メールアドレスです。email形式で指定してください。



38
39
40
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 38

def email
  @email
end

#idObject

請求先IDです。一意の識別子として自動で付与されます。



41
42
43
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 41

def id
  @id
end

#nameObject

担当者名です。



44
45
46
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 44

def name
  @name
end

#name_kanaObject

担当者名カナです。全角カタカナで入力してください。



47
48
49
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 47

def name_kana
  @name_kana
end

#objectObject

このObjectの種別を示します。ここでは必ず‘destination`が入ります。



50
51
52
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 50

def object
  @object
end

#telObject

電話番号です。ハイフン有無は任意になります。



53
54
55
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 53

def tel
  @tel
end

#titleObject

担当者の役職です。



56
57
58
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 56

def title
  @title
end

#uriObject

請求先URIです。すべてのリソースで一意の識別子として自動で付与されます。



59
60
61
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 59

def uri
  @uri
end

#zip_codeObject

郵便番号です。ハイフン有無は任意になります。但しハイフン無しで登録されますと、請求書にもハイフン無しで記載されます。



62
63
64
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 62

def zip_code
  @zip_code
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



108
109
110
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 108

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 87

def self.attribute_map
  {
    :'address1' => :'address1',
    :'address2' => :'address2',
    :'cc_emails' => :'cc_emails',
    :'created_at' => :'created_at',
    :'customer_id' => :'customer_id',
    :'department' => :'department',
    :'email' => :'email',
    :'id' => :'id',
    :'name' => :'name',
    :'name_kana' => :'name_kana',
    :'object' => :'object',
    :'tel' => :'tel',
    :'title' => :'title',
    :'uri' => :'uri',
    :'zip_code' => :'zip_code'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash



389
390
391
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 389

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



134
135
136
137
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 134

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 113

def self.openapi_types
  {
    :'address1' => :'String',
    :'address2' => :'String',
    :'cc_emails' => :'Array<String>',
    :'created_at' => :'Time',
    :'customer_id' => :'String',
    :'department' => :'String',
    :'email' => :'String',
    :'id' => :'String',
    :'name' => :'String',
    :'name_kana' => :'String',
    :'object' => :'String',
    :'tel' => :'String',
    :'title' => :'String',
    :'uri' => :'String',
    :'zip_code' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 354

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      address1 == o.address1 &&
      address2 == o.address2 &&
      cc_emails == o.cc_emails &&
      created_at == o.created_at &&
      customer_id == o.customer_id &&
      department == o.department &&
      email == o.email &&
      id == o.id &&
      name == o.name &&
      name_kana == o.name_kana &&
      object == o.object &&
      tel == o.tel &&
      title == o.title &&
      uri == o.uri &&
      zip_code == o.zip_code
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type



419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 419

def _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 = MfkOpenapiRubyClient.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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



490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 490

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



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 396

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{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[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
  end

  self
end

#eql?(o) ⇒ Boolean

See Also:

  • `==` method


376
377
378
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 376

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.



382
383
384
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 382

def hash
  [address1, address2, cc_emails, created_at, customer_id, department, email, id, name, name_kana, object, tel, title, uri, zip_code].hash
end

#list_invalid_propertiesObject

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



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
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 219

def list_invalid_properties
  invalid_properties = Array.new
  if !@address1.nil? && @address1.to_s.length > 100
    invalid_properties.push('invalid value for "address1", the character length must be smaller than or equal to 100.')
  end

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

  pattern = Regexp.new(/^(北海道|青森県|岩手県|宮城県|秋田県|山形県|福島県|茨城県|栃木県|群馬県|埼玉県|千葉県|東京都|神奈川県|新潟県|富山県|石川県|福井県|山梨県|長野県|岐阜県|静岡県|愛知県|三重県|滋賀県|京都府|大阪府|兵庫県|奈良県|和歌山県|鳥取県|島根県|岡山県|広島県|山口県|徳島県|香川県|愛媛県|高知県|福岡県|佐賀県|長崎県|熊本県|大分県|宮崎県|鹿児島県|沖縄県).+$/)
  if !@address1.nil? && @address1 !~ pattern
    invalid_properties.push("invalid value for \"address1\", must conform to the pattern #{pattern}.")
  end

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

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

  pattern = Regexp.new(/^[\w.+-]{1,64}@[a-z\d](?:[a-z\d-]{0,253}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,253}[a-z\d])?)+$/)
  if !@email.nil? && @email !~ pattern
    invalid_properties.push("invalid value for \"email\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^((0(\d{1}-?\d{4}|\d{2}-?\d{3}|\d{3}-?\d{2}|\d{4}-?\d{1}|[5789]0-?\d{4})-?\d{4})|(0120-?\d{3}-?\d{3}))$/)
  if !@tel.nil? && @tel !~ pattern
    invalid_properties.push("invalid value for \"tel\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^\d{3}-?\d{4}$/)
  if !@zip_code.nil? && @zip_code !~ pattern
    invalid_properties.push("invalid value for \"zip_code\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)



466
467
468
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 466

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash



472
473
474
475
476
477
478
479
480
481
482
483
484
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 472

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



460
461
462
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 460

def to_s
  to_hash.to_s
end

#valid?Boolean

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



262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/mfk_openapi_ruby_client/models/destination.rb', line 262

def valid?
  return false if !@address1.nil? && @address1.to_s.length > 100
  return false if !@address1.nil? && @address1.to_s.length < 1
  return false if !@address1.nil? && @address1 !~ Regexp.new(/^(北海道|青森県|岩手県|宮城県|秋田県|山形県|福島県|茨城県|栃木県|群馬県|埼玉県|千葉県|東京都|神奈川県|新潟県|富山県|石川県|福井県|山梨県|長野県|岐阜県|静岡県|愛知県|三重県|滋賀県|京都府|大阪府|兵庫県|奈良県|和歌山県|鳥取県|島根県|岡山県|広島県|山口県|徳島県|香川県|愛媛県|高知県|福岡県|佐賀県|長崎県|熊本県|大分県|宮崎県|鹿児島県|沖縄県).+$/)
  return false if !@address2.nil? && @address2.to_s.length > 100
  return false if !@email.nil? && @email.to_s.length > 255
  return false if !@email.nil? && @email !~ Regexp.new(/^[\w.+-]{1,64}@[a-z\d](?:[a-z\d-]{0,253}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,253}[a-z\d])?)+$/)
  object_validator = EnumAttributeValidator.new('String', ["destination"])
  return false unless object_validator.valid?(@object)
  return false if !@tel.nil? && @tel !~ Regexp.new(/^((0(\d{1}-?\d{4}|\d{2}-?\d{3}|\d{3}-?\d{2}|\d{4}-?\d{1}|[5789]0-?\d{4})-?\d{4})|(0120-?\d{3}-?\d{3}))$/)
  return false if !@zip_code.nil? && @zip_code !~ Regexp.new(/^\d{3}-?\d{4}$/)
  true
end