Class: Merge::Accounting::PatchedItemRequestRequest
- Inherits:
-
Object
- Object
- Merge::Accounting::PatchedItemRequestRequest
- Defined in:
- lib/merge_ruby_client/accounting/types/patched_item_request_request.rb
Overview
# The Item Object
### Description
The `Item` object refers to the goods involved in a transaction.
### Usage Example
Fetch from the `LIST Items` endpoint and view a company's items.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#company ⇒ String
readonly
The company the item belongs to.
- #integration_params ⇒ Hash{String => Object} readonly
- #linked_account_params ⇒ Hash{String => Object} readonly
-
#name ⇒ String
readonly
The item’s name.
-
#purchase_account ⇒ String
readonly
References the default account used to record a purchase of the item.
-
#purchase_price ⇒ Float
readonly
The price at which the item is purchased from a vendor.
-
#purchase_tax_rate ⇒ String
readonly
The default purchase tax rate for this item.
-
#sales_account ⇒ String
readonly
References the default account used to record a sale.
-
#sales_tax_rate ⇒ String
readonly
The default sales tax rate for this item.
-
#status ⇒ Merge::Accounting::Status7D1Enum
readonly
The item’s status.
-
#type ⇒ Merge::Accounting::Type2BbEnum
readonly
The item’s type.
-
#unit_price ⇒ Float
readonly
The item’s unit price.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Accounting::PatchedItemRequestRequest
Deserialize a JSON object to an instance of PatchedItemRequestRequest.
-
.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(name: OMIT, status: OMIT, type: OMIT, unit_price: OMIT, purchase_price: OMIT, purchase_account: OMIT, sales_account: OMIT, company: OMIT, purchase_tax_rate: OMIT, sales_tax_rate: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Accounting::PatchedItemRequestRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PatchedItemRequestRequest to a JSON object.
Constructor Details
#initialize(name: OMIT, status: OMIT, type: OMIT, unit_price: OMIT, purchase_price: OMIT, purchase_account: OMIT, sales_account: OMIT, company: OMIT, purchase_tax_rate: OMIT, sales_tax_rate: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Accounting::PatchedItemRequestRequest
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 74 def initialize(name: OMIT, status: OMIT, type: OMIT, unit_price: OMIT, purchase_price: OMIT, purchase_account: OMIT, sales_account: OMIT, company: OMIT, purchase_tax_rate: OMIT, sales_tax_rate: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) @name = name if name != OMIT @status = status if status != OMIT @type = type if type != OMIT @unit_price = unit_price if unit_price != OMIT @purchase_price = purchase_price if purchase_price != OMIT @purchase_account = purchase_account if purchase_account != OMIT @sales_account = sales_account if sales_account != OMIT @company = company if company != OMIT @purchase_tax_rate = purchase_tax_rate if purchase_tax_rate != OMIT @sales_tax_rate = sales_tax_rate if sales_tax_rate != OMIT @integration_params = integration_params if integration_params != OMIT @linked_account_params = linked_account_params if linked_account_params != OMIT @additional_properties = additional_properties @_field_set = { "name": name, "status": status, "type": type, "unit_price": unit_price, "purchase_price": purchase_price, "purchase_account": purchase_account, "sales_account": sales_account, "company": company, "purchase_tax_rate": purchase_tax_rate, "sales_tax_rate": sales_tax_rate, "integration_params": integration_params, "linked_account_params": linked_account_params }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
47 48 49 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 47 def additional_properties @additional_properties end |
#company ⇒ String (readonly)
37 38 39 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 37 def company @company end |
#integration_params ⇒ Hash{String => Object} (readonly)
43 44 45 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 43 def integration_params @integration_params end |
#linked_account_params ⇒ Hash{String => Object} (readonly)
45 46 47 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 45 def linked_account_params @linked_account_params end |
#name ⇒ String (readonly)
17 18 19 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 17 def name @name end |
#purchase_account ⇒ String (readonly)
33 34 35 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 33 def purchase_account @purchase_account end |
#purchase_price ⇒ Float (readonly)
31 32 33 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 31 def purchase_price @purchase_price end |
#purchase_tax_rate ⇒ String (readonly)
39 40 41 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 39 def purchase_tax_rate @purchase_tax_rate end |
#sales_account ⇒ String (readonly)
35 36 37 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 35 def sales_account @sales_account end |
#sales_tax_rate ⇒ String (readonly)
41 42 43 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 41 def sales_tax_rate @sales_tax_rate end |
#status ⇒ Merge::Accounting::Status7D1Enum (readonly)
21 22 23 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 21 def status @status end |
#type ⇒ Merge::Accounting::Type2BbEnum (readonly)
27 28 29 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 27 def type @type end |
#unit_price ⇒ Float (readonly)
29 30 31 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 29 def unit_price @unit_price end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Accounting::PatchedItemRequestRequest
Deserialize a JSON object to an instance of PatchedItemRequestRequest
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 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 111 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) name = parsed_json["name"] status = parsed_json["status"] type = parsed_json["type"] unit_price = parsed_json["unit_price"] purchase_price = parsed_json["purchase_price"] purchase_account = parsed_json["purchase_account"] sales_account = parsed_json["sales_account"] company = parsed_json["company"] purchase_tax_rate = parsed_json["purchase_tax_rate"] sales_tax_rate = parsed_json["sales_tax_rate"] integration_params = parsed_json["integration_params"] linked_account_params = parsed_json["linked_account_params"] new( name: name, status: status, type: type, unit_price: unit_price, purchase_price: purchase_price, purchase_account: purchase_account, sales_account: sales_account, company: company, purchase_tax_rate: purchase_tax_rate, sales_tax_rate: sales_tax_rate, integration_params: integration_params, linked_account_params: linked_account_params, 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.
156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 156 def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.status&.is_a?(Merge::Accounting::Status7D1Enum) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.type&.is_a?(Merge::Accounting::Type2BbEnum) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") obj.unit_price&.is_a?(Float) != false || raise("Passed value for field obj.unit_price is not the expected type, validation failed.") obj.purchase_price&.is_a?(Float) != false || raise("Passed value for field obj.purchase_price is not the expected type, validation failed.") obj.purchase_account&.is_a?(String) != false || raise("Passed value for field obj.purchase_account is not the expected type, validation failed.") obj.sales_account&.is_a?(String) != false || raise("Passed value for field obj.sales_account is not the expected type, validation failed.") obj.company&.is_a?(String) != false || raise("Passed value for field obj.company is not the expected type, validation failed.") obj.purchase_tax_rate&.is_a?(String) != false || raise("Passed value for field obj.purchase_tax_rate is not the expected type, validation failed.") obj.sales_tax_rate&.is_a?(String) != false || raise("Passed value for field obj.sales_tax_rate is not the expected type, validation failed.") obj.integration_params&.is_a?(Hash) != false || raise("Passed value for field obj.integration_params is not the expected type, validation failed.") obj.linked_account_params&.is_a?(Hash) != false || raise("Passed value for field obj.linked_account_params is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of PatchedItemRequestRequest to a JSON object
146 147 148 |
# File 'lib/merge_ruby_client/accounting/types/patched_item_request_request.rb', line 146 def to_json(*_args) @_field_set&.to_json end |