Class: FactPulse::CreateCDARRequest

Inherits:
ApiModelBase show all
Defined in:
lib/factpulse/models/create_cdar_request.rb

Overview

Requête de création d’un message CDAR.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ CreateCDARRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



139
140
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
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
# File 'lib/factpulse/models/create_cdar_request.rb', line 139

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

  if attributes.key?(:'business_process')
    self.business_process = attributes[:'business_process']
  else
    self.business_process = 'REGULATED'
  end

  if attributes.key?(:'type_code')
    self.type_code = attributes[:'type_code']
  else
    self.type_code = '23'
  end

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

  if attributes.key?(:'sender_role')
    self.sender_role = attributes[:'sender_role']
  else
    self.sender_role = 'WK'
  end

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

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

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

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

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

  if attributes.key?(:'invoice_type_code')
    self.invoice_type_code = attributes[:'invoice_type_code']
  else
    self.invoice_type_code = '380'
  end

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

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

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

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

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

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

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

Instance Attribute Details

#action_codeObject

Returns the value of attribute action_code.



61
62
63
# File 'lib/factpulse/models/create_cdar_request.rb', line 61

def action_code
  @action_code
end

#business_processObject

Code processus métier (REGULATED, B2C, B2BINT, etc.)



23
24
25
# File 'lib/factpulse/models/create_cdar_request.rb', line 23

def business_process
  @business_process
end

#document_idObject

Identifiant unique du message CDAR



20
21
22
# File 'lib/factpulse/models/create_cdar_request.rb', line 20

def document_id
  @document_id
end

#encaisse_amountObject

Returns the value of attribute encaisse_amount.



63
64
65
# File 'lib/factpulse/models/create_cdar_request.rb', line 63

def encaisse_amount
  @encaisse_amount
end

#invoice_buyer_sirenObject

Returns the value of attribute invoice_buyer_siren.



52
53
54
# File 'lib/factpulse/models/create_cdar_request.rb', line 52

def invoice_buyer_siren
  @invoice_buyer_siren
end

#invoice_idObject

Identifiant de la facture (BT-1)



42
43
44
# File 'lib/factpulse/models/create_cdar_request.rb', line 42

def invoice_id
  @invoice_id
end

#invoice_issue_dateObject

Date d’émission de la facture (YYYY-MM-DD)



45
46
47
# File 'lib/factpulse/models/create_cdar_request.rb', line 45

def invoice_issue_date
  @invoice_issue_date
end

#invoice_seller_sirenObject

Returns the value of attribute invoice_seller_siren.



50
51
52
# File 'lib/factpulse/models/create_cdar_request.rb', line 50

def invoice_seller_siren
  @invoice_seller_siren
end

#invoice_type_codeObject

Type de document (380=Facture, 381=Avoir)



48
49
50
# File 'lib/factpulse/models/create_cdar_request.rb', line 48

def invoice_type_code
  @invoice_type_code
end

#reason_codeObject

Returns the value of attribute reason_code.



57
58
59
# File 'lib/factpulse/models/create_cdar_request.rb', line 57

def reason_code
  @reason_code
end

#reason_textObject

Returns the value of attribute reason_text.



59
60
61
# File 'lib/factpulse/models/create_cdar_request.rb', line 59

def reason_text
  @reason_text
end

#recipientsObject

Liste des destinataires



39
40
41
# File 'lib/factpulse/models/create_cdar_request.rb', line 39

def recipients
  @recipients
end

#sender_emailObject

Returns the value of attribute sender_email.



36
37
38
# File 'lib/factpulse/models/create_cdar_request.rb', line 36

def sender_email
  @sender_email
end

#sender_nameObject

Returns the value of attribute sender_name.



34
35
36
# File 'lib/factpulse/models/create_cdar_request.rb', line 34

def sender_name
  @sender_name
end

#sender_roleObject

Rôle de l’émetteur (WK, SE, BY, etc.)



32
33
34
# File 'lib/factpulse/models/create_cdar_request.rb', line 32

def sender_role
  @sender_role
end

#sender_sirenObject

SIREN de l’émetteur (9 chiffres)



29
30
31
# File 'lib/factpulse/models/create_cdar_request.rb', line 29

def sender_siren
  @sender_siren
end

#statusObject

Code statut de la facture (200-601)



55
56
57
# File 'lib/factpulse/models/create_cdar_request.rb', line 55

def status
  @status
end

#type_codeObject

Type de message (23=Traitement, 305=Transmission)



26
27
28
# File 'lib/factpulse/models/create_cdar_request.rb', line 26

def type_code
  @type_code
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



90
91
92
# File 'lib/factpulse/models/create_cdar_request.rb', line 90

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



95
96
97
# File 'lib/factpulse/models/create_cdar_request.rb', line 95

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/factpulse/models/create_cdar_request.rb', line 66

def self.attribute_map
  {
    :'document_id' => :'documentId',
    :'business_process' => :'businessProcess',
    :'type_code' => :'typeCode',
    :'sender_siren' => :'senderSiren',
    :'sender_role' => :'senderRole',
    :'sender_name' => :'senderName',
    :'sender_email' => :'senderEmail',
    :'recipients' => :'recipients',
    :'invoice_id' => :'invoiceId',
    :'invoice_issue_date' => :'invoiceIssueDate',
    :'invoice_type_code' => :'invoiceTypeCode',
    :'invoice_seller_siren' => :'invoiceSellerSiren',
    :'invoice_buyer_siren' => :'invoiceBuyerSiren',
    :'status' => :'status',
    :'reason_code' => :'reasonCode',
    :'reason_text' => :'reasonText',
    :'action_code' => :'actionCode',
    :'encaisse_amount' => :'encaisseAmount'
  }
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



376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/factpulse/models/create_cdar_request.rb', line 376

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



124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/factpulse/models/create_cdar_request.rb', line 124

def self.openapi_nullable
  Set.new([
    :'sender_name',
    :'sender_email',
    :'invoice_seller_siren',
    :'invoice_buyer_siren',
    :'reason_code',
    :'reason_text',
    :'action_code',
    :'encaisse_amount'
  ])
end

.openapi_typesObject

Attribute type mapping.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/factpulse/models/create_cdar_request.rb', line 100

def self.openapi_types
  {
    :'document_id' => :'String',
    :'business_process' => :'String',
    :'type_code' => :'String',
    :'sender_siren' => :'String',
    :'sender_role' => :'String',
    :'sender_name' => :'String',
    :'sender_email' => :'String',
    :'recipients' => :'Array<RecipientInput>',
    :'invoice_id' => :'String',
    :'invoice_issue_date' => :'Date',
    :'invoice_type_code' => :'String',
    :'invoice_seller_siren' => :'String',
    :'invoice_buyer_siren' => :'String',
    :'status' => :'String',
    :'reason_code' => :'String',
    :'reason_text' => :'String',
    :'action_code' => :'String',
    :'encaisse_amount' => :'Encaisseamount'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/factpulse/models/create_cdar_request.rb', line 338

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      document_id == o.document_id &&
      business_process == o.business_process &&
      type_code == o.type_code &&
      sender_siren == o.sender_siren &&
      sender_role == o.sender_role &&
      sender_name == o.sender_name &&
      sender_email == o.sender_email &&
      recipients == o.recipients &&
      invoice_id == o.invoice_id &&
      invoice_issue_date == o.invoice_issue_date &&
      invoice_type_code == o.invoice_type_code &&
      invoice_seller_siren == o.invoice_seller_siren &&
      invoice_buyer_siren == o.invoice_buyer_siren &&
      status == o.status &&
      reason_code == o.reason_code &&
      reason_text == o.reason_text &&
      action_code == o.action_code &&
      encaisse_amount == o.encaisse_amount
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


363
364
365
# File 'lib/factpulse/models/create_cdar_request.rb', line 363

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



369
370
371
# File 'lib/factpulse/models/create_cdar_request.rb', line 369

def hash
  [document_id, business_process, type_code, sender_siren, sender_role, sender_name, sender_email, recipients, invoice_id, invoice_issue_date, invoice_type_code, invoice_seller_siren, invoice_buyer_siren, status, reason_code, reason_text, action_code, encaisse_amount].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/factpulse/models/create_cdar_request.rb', line 248

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @document_id.nil?
    invalid_properties.push('invalid value for "document_id", document_id cannot be nil.')
  end

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

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

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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/factpulse/models/create_cdar_request.rb', line 398

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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



276
277
278
279
280
281
282
283
284
# File 'lib/factpulse/models/create_cdar_request.rb', line 276

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @document_id.nil?
  return false if @sender_siren.nil?
  return false if @invoice_id.nil?
  return false if @invoice_issue_date.nil?
  return false if @status.nil?
  true
end