Class: MfkOpenapiRubyClient::CustomerPayloadDestination

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

Overview

請求先情報です。

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CustomerPayloadDestination

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
122
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/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 94

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `MfkOpenapiRubyClient::CustomerPayloadDestination` 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::CustomerPayloadDestination`. 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?(:'department')
    self.department = attributes[:'department']
  end

  if attributes.key?(:'email')
    self.email = attributes[:'email']
  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?(:'tel')
    self.tel = attributes[:'tel']
  end

  if attributes.key?(:'title')
    self.title = attributes[:'title']
  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/customer_payload_destination.rb', line 20

def address1
  @address1
end

#address2Object

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



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

def address2
  @address2
end

#cc_emailsObject

請求書をメール送付する際のCCメールアドレスです。最大で4つまで指定できます。



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

def cc_emails
  @cc_emails
end

#departmentObject

担当者の部署名です。



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

def department
  @department
end

#emailObject

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



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

def email
  @email
end

#nameObject

担当者氏名です。



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

def name
  @name
end

#name_kanaObject

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



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

def name_kana
  @name_kana
end

#telObject

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



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

def tel
  @tel
end

#titleObject

担当者の役職です。



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

def title
  @title
end

#zip_codeObject

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



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

def zip_code
  @zip_code
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



66
67
68
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 66

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 50

def self.attribute_map
  {
    :'address1' => :'address1',
    :'address2' => :'address2',
    :'cc_emails' => :'cc_emails',
    :'department' => :'department',
    :'email' => :'email',
    :'name' => :'name',
    :'name_kana' => :'name_kana',
    :'tel' => :'tel',
    :'title' => :'title',
    :'zip_code' => :'zip_code'
  }
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



416
417
418
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 416

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

.openapi_nullableObject

List of attributes with nullable: true



87
88
89
90
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 87

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

.openapi_typesObject

Attribute type mapping.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 71

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

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 386

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      address1 == o.address1 &&
      address2 == o.address2 &&
      cc_emails == o.cc_emails &&
      department == o.department &&
      email == o.email &&
      name == o.name &&
      name_kana == o.name_kana &&
      tel == o.tel &&
      title == o.title &&
      zip_code == o.zip_code
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



446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 446

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



517
518
519
520
521
522
523
524
525
526
527
528
529
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 517

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



423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 423

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


403
404
405
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 403

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



409
410
411
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 409

def hash
  [address1, address2, cc_emails, department, email, name, name_kana, tel, title, zip_code].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

def list_invalid_properties
  invalid_properties = Array.new
  if @address1.nil?
    invalid_properties.push('invalid value for "address1", address1 cannot be nil.')
  end

  if @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.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 !~ 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 !@cc_emails.nil? && @cc_emails.length > 4
    invalid_properties.push('invalid value for "cc_emails", number of items must be less than or equal to 4.')
  end

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

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

  if @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 !~ pattern
    invalid_properties.push("invalid value for \"email\", must conform to the pattern #{pattern}.")
  end

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

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

  if @tel.nil?
    invalid_properties.push('invalid value for "tel", tel cannot be nil.')
  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 !~ pattern
    invalid_properties.push("invalid value for \"tel\", must conform to the pattern #{pattern}.")
  end

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

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

  pattern = Regexp.new(/^\d{3}-?\d{4}$/)
  if @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)

Returns:

  • (Hash)

    Returns the object in the form of hash



493
494
495
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 493

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



499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 499

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



487
488
489
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 487

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



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/mfk_openapi_ruby_client/models/customer_payload_destination.rb', line 231

def valid?
  return false if @address1.nil?
  return false if @address1.to_s.length > 100
  return false if @address1.to_s.length < 1
  return false if @address1 !~ Regexp.new(/^(北海道|青森県|岩手県|宮城県|秋田県|山形県|福島県|茨城県|栃木県|群馬県|埼玉県|千葉県|東京都|神奈川県|新潟県|富山県|石川県|福井県|山梨県|長野県|岐阜県|静岡県|愛知県|三重県|滋賀県|京都府|大阪府|兵庫県|奈良県|和歌山県|鳥取県|島根県|岡山県|広島県|山口県|徳島県|香川県|愛媛県|高知県|福岡県|佐賀県|長崎県|熊本県|大分県|宮崎県|鹿児島県|沖縄県).+$/)
  return false if !@address2.nil? && @address2.to_s.length > 100
  return false if !@cc_emails.nil? && @cc_emails.length > 4
  return false if !@department.nil? && @department.to_s.length > 50
  return false if @email.nil?
  return false if @email.to_s.length > 255
  return false if @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])?)+$/)
  return false if !@name.nil? && @name.to_s.length > 30
  return false if !@name_kana.nil? && @name_kana.to_s.length > 60
  return false if @tel.nil?
  return false if @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 !@title.nil? && @title.to_s.length > 30
  return false if @zip_code.nil?
  return false if @zip_code !~ Regexp.new(/^\d{3}-?\d{4}$/)
  true
end