Class: Merge::Accounting::VendorCreditLineRequest
- Inherits:
-
Object
- Object
- Merge::Accounting::VendorCreditLineRequest
- Defined in:
- lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb
Overview
# The VendorCreditLine Object
### Description
The `VendorCreditLine` object is used to represent a vendor credit's line items.
### Usage Example
Fetch from the `GET VendorCredit` endpoint and view the vendor credit's line
items.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#account ⇒ Merge::Accounting::VendorCreditLineRequestAccount
readonly
The line’s account.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#company ⇒ String
readonly
The company the line belongs to.
- #contact ⇒ Merge::Accounting::VendorCreditLineRequestContact readonly
-
#description ⇒ String
readonly
The line’s description.
-
#exchange_rate ⇒ String
readonly
The vendor credit line item’s exchange rate.
- #integration_params ⇒ Hash{String => Object} readonly
- #linked_account_params ⇒ Hash{String => Object} readonly
-
#net_amount ⇒ Float
readonly
The full value of the credit.
- #project ⇒ Merge::Accounting::VendorCreditLineRequestProject readonly
-
#remote_id ⇒ String
readonly
The third-party API ID of the matching object.
-
#tax_rate ⇒ String
readonly
The tax rate that applies to this line item.
-
#tracking_categories ⇒ Array<String>
readonly
The vendor credit line item’s associated tracking categories.
-
#tracking_category ⇒ String
readonly
The line’s associated tracking category.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Accounting::VendorCreditLineRequest
Deserialize a JSON object to an instance of VendorCreditLineRequest.
-
.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(remote_id: OMIT, net_amount: OMIT, tracking_category: OMIT, tracking_categories: OMIT, description: OMIT, account: OMIT, company: OMIT, project: OMIT, contact: OMIT, tax_rate: OMIT, exchange_rate: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Accounting::VendorCreditLineRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of VendorCreditLineRequest to a JSON object.
Constructor Details
#initialize(remote_id: OMIT, net_amount: OMIT, tracking_category: OMIT, tracking_categories: OMIT, description: OMIT, account: OMIT, company: OMIT, project: OMIT, contact: OMIT, tax_rate: OMIT, exchange_rate: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Accounting::VendorCreditLineRequest
67 68 69 70 71 72 73 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 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 67 def initialize(remote_id: OMIT, net_amount: OMIT, tracking_category: OMIT, tracking_categories: OMIT, description: OMIT, account: OMIT, company: OMIT, project: OMIT, contact: OMIT, tax_rate: OMIT, exchange_rate: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) @remote_id = remote_id if remote_id != OMIT @net_amount = net_amount if net_amount != OMIT @tracking_category = tracking_category if tracking_category != OMIT @tracking_categories = tracking_categories if tracking_categories != OMIT @description = description if description != OMIT @account = account if account != OMIT @company = company if company != OMIT @project = project if project != OMIT @contact = contact if contact != OMIT @tax_rate = tax_rate if tax_rate != OMIT @exchange_rate = exchange_rate if exchange_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 = { "remote_id": remote_id, "net_amount": net_amount, "tracking_category": tracking_category, "tracking_categories": tracking_categories, "description": description, "account": account, "company": company, "project": project, "contact": contact, "tax_rate": tax_rate, "exchange_rate": exchange_rate, "integration_params": integration_params, "linked_account_params": linked_account_params }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#account ⇒ Merge::Accounting::VendorCreditLineRequestAccount (readonly)
29 30 31 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 29 def account @account end |
#additional_properties ⇒ OpenStruct (readonly)
45 46 47 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 45 def additional_properties @additional_properties end |
#company ⇒ String (readonly)
31 32 33 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 31 def company @company end |
#contact ⇒ Merge::Accounting::VendorCreditLineRequestContact (readonly)
35 36 37 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 35 def contact @contact end |
#description ⇒ String (readonly)
27 28 29 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 27 def description @description end |
#exchange_rate ⇒ String (readonly)
39 40 41 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 39 def exchange_rate @exchange_rate end |
#integration_params ⇒ Hash{String => Object} (readonly)
41 42 43 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 41 def integration_params @integration_params end |
#linked_account_params ⇒ Hash{String => Object} (readonly)
43 44 45 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 43 def linked_account_params @linked_account_params end |
#net_amount ⇒ Float (readonly)
21 22 23 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 21 def net_amount @net_amount end |
#project ⇒ Merge::Accounting::VendorCreditLineRequestProject (readonly)
33 34 35 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 33 def project @project end |
#remote_id ⇒ String (readonly)
19 20 21 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 19 def remote_id @remote_id end |
#tax_rate ⇒ String (readonly)
37 38 39 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 37 def tax_rate @tax_rate end |
#tracking_categories ⇒ Array<String> (readonly)
25 26 27 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 25 def tracking_categories @tracking_categories end |
#tracking_category ⇒ String (readonly)
23 24 25 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 23 def tracking_category @tracking_category end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Accounting::VendorCreditLineRequest
Deserialize a JSON object to an instance of VendorCreditLineRequest
106 107 108 109 110 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 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 106 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) remote_id = parsed_json["remote_id"] net_amount = parsed_json["net_amount"] tracking_category = parsed_json["tracking_category"] tracking_categories = parsed_json["tracking_categories"] description = parsed_json["description"] if parsed_json["account"].nil? account = nil else account = parsed_json["account"].to_json account = Merge::Accounting::VendorCreditLineRequestAccount.from_json(json_object: account) end company = parsed_json["company"] if parsed_json["project"].nil? project = nil else project = parsed_json["project"].to_json project = Merge::Accounting::VendorCreditLineRequestProject.from_json(json_object: project) end if parsed_json["contact"].nil? contact = nil else contact = parsed_json["contact"].to_json contact = Merge::Accounting::VendorCreditLineRequestContact.from_json(json_object: contact) end tax_rate = parsed_json["tax_rate"] exchange_rate = parsed_json["exchange_rate"] integration_params = parsed_json["integration_params"] linked_account_params = parsed_json["linked_account_params"] new( remote_id: remote_id, net_amount: net_amount, tracking_category: tracking_category, tracking_categories: tracking_categories, description: description, account: account, company: company, project: project, contact: contact, tax_rate: tax_rate, exchange_rate: exchange_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.
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 168 def self.validate_raw(obj:) obj.remote_id&.is_a?(String) != false || raise("Passed value for field obj.remote_id is not the expected type, validation failed.") obj.net_amount&.is_a?(Float) != false || raise("Passed value for field obj.net_amount is not the expected type, validation failed.") obj.tracking_category&.is_a?(String) != false || raise("Passed value for field obj.tracking_category is not the expected type, validation failed.") obj.tracking_categories&.is_a?(Array) != false || raise("Passed value for field obj.tracking_categories is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.account.nil? || Merge::Accounting::VendorCreditLineRequestAccount.validate_raw(obj: obj.account) obj.company&.is_a?(String) != false || raise("Passed value for field obj.company is not the expected type, validation failed.") obj.project.nil? || Merge::Accounting::VendorCreditLineRequestProject.validate_raw(obj: obj.project) obj.contact.nil? || Merge::Accounting::VendorCreditLineRequestContact.validate_raw(obj: obj.contact) obj.tax_rate&.is_a?(String) != false || raise("Passed value for field obj.tax_rate is not the expected type, validation failed.") obj.exchange_rate&.is_a?(String) != false || raise("Passed value for field obj.exchange_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 VendorCreditLineRequest to a JSON object
158 159 160 |
# File 'lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb', line 158 def to_json(*_args) @_field_set&.to_json end |