Class: FactPulse::SubmitInvoiceRequest

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

Overview

Submit an invoice to Chorus Pro.

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 = {}) ⇒ SubmitInvoiceRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#commentObject

Returns the value of attribute comment.



46
47
48
# File 'lib/factpulse/models/submit_invoice_request.rb', line 46

def comment
  @comment
end

#contract_referenceObject

Returns the value of attribute contract_reference.



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

def contract_reference
  @contract_reference
end

#credentialsObject

Returns the value of attribute credentials.



19
20
21
# File 'lib/factpulse/models/submit_invoice_request.rb', line 19

def credentials
  @credentials
end

#engagement_numberObject

Returns the value of attribute engagement_number.



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

def engagement_number
  @engagement_number
end

#invoice_dateObject

Invoice date (ISO format: YYYY-MM-DD)



25
26
27
# File 'lib/factpulse/models/submit_invoice_request.rb', line 25

def invoice_date
  @invoice_date
end

#invoice_numberObject

Invoice number



22
23
24
# File 'lib/factpulse/models/submit_invoice_request.rb', line 22

def invoice_number
  @invoice_number
end

#main_attachment_idObject

Returns the value of attribute main_attachment_id.



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

def main_attachment_id
  @main_attachment_id
end

#main_attachment_labelObject

Returns the value of attribute main_attachment_label.



44
45
46
# File 'lib/factpulse/models/submit_invoice_request.rb', line 44

def main_attachment_label
  @main_attachment_label
end

#payment_due_dateObject

Returns the value of attribute payment_due_date.



27
28
29
# File 'lib/factpulse/models/submit_invoice_request.rb', line 27

def payment_due_date
  @payment_due_date
end

#purchase_order_referenceObject

Returns the value of attribute purchase_order_reference.



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

def purchase_order_reference
  @purchase_order_reference
end

#service_codeObject

Returns the value of attribute service_code.



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

def service_code
  @service_code
end

#structure_idObject

Chorus Pro recipient structure ID



30
31
32
# File 'lib/factpulse/models/submit_invoice_request.rb', line 30

def structure_id
  @structure_id
end

#total_gross_amountObject

Returns the value of attribute total_gross_amount.



40
41
42
# File 'lib/factpulse/models/submit_invoice_request.rb', line 40

def total_gross_amount
  @total_gross_amount
end

#total_net_amountObject

Returns the value of attribute total_net_amount.



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

def total_net_amount
  @total_net_amount
end

#vat_amountObject

Returns the value of attribute vat_amount.



38
39
40
# File 'lib/factpulse/models/submit_invoice_request.rb', line 38

def vat_amount
  @vat_amount
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



74
75
76
# File 'lib/factpulse/models/submit_invoice_request.rb', line 74

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



79
80
81
# File 'lib/factpulse/models/submit_invoice_request.rb', line 79

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/factpulse/models/submit_invoice_request.rb', line 53

def self.attribute_map
  {
    :'credentials' => :'credentials',
    :'invoice_number' => :'invoice_number',
    :'invoice_date' => :'invoice_date',
    :'payment_due_date' => :'payment_due_date',
    :'structure_id' => :'structure_id',
    :'service_code' => :'service_code',
    :'engagement_number' => :'engagement_number',
    :'total_net_amount' => :'total_net_amount',
    :'vat_amount' => :'vat_amount',
    :'total_gross_amount' => :'total_gross_amount',
    :'main_attachment_id' => :'main_attachment_id',
    :'main_attachment_label' => :'main_attachment_label',
    :'comment' => :'comment',
    :'purchase_order_reference' => :'purchase_order_reference',
    :'contract_reference' => :'contract_reference'
  }
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



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/factpulse/models/submit_invoice_request.rb', line 350

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



105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/factpulse/models/submit_invoice_request.rb', line 105

def self.openapi_nullable
  Set.new([
    :'credentials',
    :'payment_due_date',
    :'service_code',
    :'engagement_number',
    :'main_attachment_id',
    :'main_attachment_label',
    :'comment',
    :'purchase_order_reference',
    :'contract_reference'
  ])
end

.openapi_typesObject

Attribute type mapping.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/factpulse/models/submit_invoice_request.rb', line 84

def self.openapi_types
  {
    :'credentials' => :'FactureElectroniqueRestApiSchemasChorusProChorusProCredentials',
    :'invoice_number' => :'String',
    :'invoice_date' => :'String',
    :'payment_due_date' => :'String',
    :'structure_id' => :'Integer',
    :'service_code' => :'String',
    :'engagement_number' => :'String',
    :'total_net_amount' => :'SubmitNetAmount',
    :'vat_amount' => :'SubmitVatAmount',
    :'total_gross_amount' => :'SubmitGrossAmount',
    :'main_attachment_id' => :'Integer',
    :'main_attachment_label' => :'String',
    :'comment' => :'String',
    :'purchase_order_reference' => :'String',
    :'contract_reference' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/factpulse/models/submit_invoice_request.rb', line 315

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      credentials == o.credentials &&
      invoice_number == o.invoice_number &&
      invoice_date == o.invoice_date &&
      payment_due_date == o.payment_due_date &&
      structure_id == o.structure_id &&
      service_code == o.service_code &&
      engagement_number == o.engagement_number &&
      total_net_amount == o.total_net_amount &&
      vat_amount == o.vat_amount &&
      total_gross_amount == o.total_gross_amount &&
      main_attachment_id == o.main_attachment_id &&
      main_attachment_label == o.main_attachment_label &&
      comment == o.comment &&
      purchase_order_reference == o.purchase_order_reference &&
      contract_reference == o.contract_reference
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


337
338
339
# File 'lib/factpulse/models/submit_invoice_request.rb', line 337

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



343
344
345
# File 'lib/factpulse/models/submit_invoice_request.rb', line 343

def hash
  [credentials, invoice_number, invoice_date, payment_due_date, structure_id, service_code, engagement_number, total_net_amount, vat_amount, total_gross_amount, main_attachment_id, main_attachment_label, comment, purchase_order_reference, contract_reference].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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

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

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

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

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

  if @total_gross_amount.nil?
    invalid_properties.push('invalid value for "total_gross_amount", total_gross_amount 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



372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/factpulse/models/submit_invoice_request.rb', line 372

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



242
243
244
245
246
247
248
249
250
251
# File 'lib/factpulse/models/submit_invoice_request.rb', line 242

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @invoice_number.nil?
  return false if @invoice_date.nil?
  return false if @structure_id.nil?
  return false if @total_net_amount.nil?
  return false if @vat_amount.nil?
  return false if @total_gross_amount.nil?
  true
end