Class: NewDemoApiClient::IncomeStatementEntry
- Inherits:
-
Object
- Object
- NewDemoApiClient::IncomeStatementEntry
- Defined in:
- lib/test_sdk/types/income_statement_entry.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#category ⇒ String
readonly
The category of the entry.
-
#date ⇒ String
readonly
The date of the entry.
-
#field ⇒ String
readonly
The original field name of the entry.
-
#value ⇒ Float
readonly
The value of the entry.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::IncomeStatementEntry
Deserialize a JSON object to an instance of IncomeStatementEntry.
-
.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(date:, category:, field:, value: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::IncomeStatementEntry constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of IncomeStatementEntry to a JSON object.
Constructor Details
#initialize(date:, category:, field:, value: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::IncomeStatementEntry
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/test_sdk/types/income_statement_entry.rb', line 30 def initialize(date:, category:, field:, value: OMIT, additional_properties: nil) @date = date @category = category @field = field @value = value if value != OMIT @additional_properties = additional_properties @_field_set = { "date": date, "category": category, "field": field, "value": value }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/test_sdk/types/income_statement_entry.rb', line 17 def additional_properties @additional_properties end |
#category ⇒ String (readonly)
Returns The category of the entry.
11 12 13 |
# File 'lib/test_sdk/types/income_statement_entry.rb', line 11 def category @category end |
#date ⇒ String (readonly)
Returns The date of the entry.
9 10 11 |
# File 'lib/test_sdk/types/income_statement_entry.rb', line 9 def date @date end |
#field ⇒ String (readonly)
Returns The original field name of the entry.
13 14 15 |
# File 'lib/test_sdk/types/income_statement_entry.rb', line 13 def field @field end |
#value ⇒ Float (readonly)
Returns The value of the entry.
15 16 17 |
# File 'lib/test_sdk/types/income_statement_entry.rb', line 15 def value @value end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::IncomeStatementEntry
Deserialize a JSON object to an instance of IncomeStatementEntry
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/test_sdk/types/income_statement_entry.rb', line 45 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) date = parsed_json["date"] category = parsed_json["category"] field = parsed_json["field"] value = parsed_json["value"] new( date: date, category: category, field: field, value: value, 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.
74 75 76 77 78 79 |
# File 'lib/test_sdk/types/income_statement_entry.rb', line 74 def self.validate_raw(obj:) obj.date.is_a?(String) != false || raise("Passed value for field obj.date is not the expected type, validation failed.") obj.category.is_a?(String) != false || raise("Passed value for field obj.category is not the expected type, validation failed.") obj.field.is_a?(String) != false || raise("Passed value for field obj.field is not the expected type, validation failed.") obj.value&.is_a?(Float) != false || raise("Passed value for field obj.value is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of IncomeStatementEntry to a JSON object
64 65 66 |
# File 'lib/test_sdk/types/income_statement_entry.rb', line 64 def to_json(*_args) @_field_set&.to_json end |