Class: CandidApiClient::Invoices::V2::Types::InvoiceItemCreate
- Inherits:
-
Object
- Object
- CandidApiClient::Invoices::V2::Types::InvoiceItemCreate
- Defined in:
- lib/candidhealth/invoices/v_2/types/invoice_item_create.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #amount_cents ⇒ Integer readonly
- #attribution ⇒ CandidApiClient::Invoices::V2::Types::InvoiceItemAttributionCreate readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::Invoices::V2::Types::InvoiceItemCreate
Deserialize a JSON object to an instance of InvoiceItemCreate.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(attribution:, amount_cents:, additional_properties: nil) ⇒ CandidApiClient::Invoices::V2::Types::InvoiceItemCreate constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of InvoiceItemCreate to a JSON object.
Constructor Details
#initialize(attribution:, amount_cents:, additional_properties: nil) ⇒ CandidApiClient::Invoices::V2::Types::InvoiceItemCreate
28 29 30 31 32 33 |
# File 'lib/candidhealth/invoices/v_2/types/invoice_item_create.rb', line 28 def initialize(attribution:, amount_cents:, additional_properties: nil) @attribution = attribution @amount_cents = amount_cents @additional_properties = additional_properties @_field_set = { "attribution": attribution, "amount_cents": amount_cents } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/candidhealth/invoices/v_2/types/invoice_item_create.rb', line 17 def additional_properties @additional_properties end |
#amount_cents ⇒ Integer (readonly)
15 16 17 |
# File 'lib/candidhealth/invoices/v_2/types/invoice_item_create.rb', line 15 def amount_cents @amount_cents end |
#attribution ⇒ CandidApiClient::Invoices::V2::Types::InvoiceItemAttributionCreate (readonly)
13 14 15 |
# File 'lib/candidhealth/invoices/v_2/types/invoice_item_create.rb', line 13 def attribution @attribution end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::Invoices::V2::Types::InvoiceItemCreate
Deserialize a JSON object to an instance of InvoiceItemCreate
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/candidhealth/invoices/v_2/types/invoice_item_create.rb', line 39 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["attribution"].nil? attribution = nil else attribution = parsed_json["attribution"].to_json attribution = CandidApiClient::Invoices::V2::Types::InvoiceItemAttributionCreate.from_json(json_object: attribution) end amount_cents = struct["amount_cents"] new( attribution: attribution, amount_cents: amount_cents, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
69 70 71 72 |
# File 'lib/candidhealth/invoices/v_2/types/invoice_item_create.rb', line 69 def self.validate_raw(obj:) CandidApiClient::Invoices::V2::Types::InvoiceItemAttributionCreate.validate_raw(obj: obj.attribution) obj.amount_cents.is_a?(Integer) != false || raise("Passed value for field obj.amount_cents is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of InvoiceItemCreate to a JSON object
59 60 61 |
# File 'lib/candidhealth/invoices/v_2/types/invoice_item_create.rb', line 59 def to_json(*_args) @_field_set&.to_json end |