Class: Merge::Accounting::AccountingAttachmentRequest
- Inherits:
-
Object
- Object
- Merge::Accounting::AccountingAttachmentRequest
- Defined in:
- lib/merge_ruby_client/accounting/types/accounting_attachment_request.rb
Overview
# The Accounting Attachment Object
### Description
The `AccountingAttachment` object is used to represent a company's attachments.
### Usage Example
Fetch from the `LIST AccountingAttachments` endpoint and view a company's
attachments.
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 accounting attachment belongs to.
-
#file_name ⇒ String
readonly
The attachment’s name.
-
#file_url ⇒ String
readonly
The attachment’s url.
- #integration_params ⇒ Hash{String => Object} readonly
- #linked_account_params ⇒ Hash{String => Object} readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Accounting::AccountingAttachmentRequest
Deserialize a JSON object to an instance of AccountingAttachmentRequest.
-
.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(file_name: OMIT, file_url: OMIT, company: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Accounting::AccountingAttachmentRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AccountingAttachmentRequest to a JSON object.
Constructor Details
#initialize(file_name: OMIT, file_url: OMIT, company: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Accounting::AccountingAttachmentRequest
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/merge_ruby_client/accounting/types/accounting_attachment_request.rb', line 40 def initialize(file_name: OMIT, file_url: OMIT, company: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) @file_name = file_name if file_name != OMIT @file_url = file_url if file_url != OMIT @company = company if company != 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 = { "file_name": file_name, "file_url": file_url, "company": company, "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)
Returns Additional properties unmapped to the current class definition.
26 27 28 |
# File 'lib/merge_ruby_client/accounting/types/accounting_attachment_request.rb', line 26 def additional_properties @additional_properties end |
#company ⇒ String (readonly)
Returns The company the accounting attachment belongs to.
20 21 22 |
# File 'lib/merge_ruby_client/accounting/types/accounting_attachment_request.rb', line 20 def company @company end |
#file_name ⇒ String (readonly)
Returns The attachment’s name.
16 17 18 |
# File 'lib/merge_ruby_client/accounting/types/accounting_attachment_request.rb', line 16 def file_name @file_name end |
#file_url ⇒ String (readonly)
Returns The attachment’s url.
18 19 20 |
# File 'lib/merge_ruby_client/accounting/types/accounting_attachment_request.rb', line 18 def file_url @file_url end |
#integration_params ⇒ Hash{String => Object} (readonly)
22 23 24 |
# File 'lib/merge_ruby_client/accounting/types/accounting_attachment_request.rb', line 22 def integration_params @integration_params end |
#linked_account_params ⇒ Hash{String => Object} (readonly)
24 25 26 |
# File 'lib/merge_ruby_client/accounting/types/accounting_attachment_request.rb', line 24 def linked_account_params @linked_account_params end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Accounting::AccountingAttachmentRequest
Deserialize a JSON object to an instance of AccountingAttachmentRequest
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/merge_ruby_client/accounting/types/accounting_attachment_request.rb', line 63 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) file_name = parsed_json["file_name"] file_url = parsed_json["file_url"] company = parsed_json["company"] integration_params = parsed_json["integration_params"] linked_account_params = parsed_json["linked_account_params"] new( file_name: file_name, file_url: file_url, company: company, 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.
94 95 96 97 98 99 100 |
# File 'lib/merge_ruby_client/accounting/types/accounting_attachment_request.rb', line 94 def self.validate_raw(obj:) obj.file_name&.is_a?(String) != false || raise("Passed value for field obj.file_name is not the expected type, validation failed.") obj.file_url&.is_a?(String) != false || raise("Passed value for field obj.file_url 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.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 AccountingAttachmentRequest to a JSON object
84 85 86 |
# File 'lib/merge_ruby_client/accounting/types/accounting_attachment_request.rb', line 84 def to_json(*_args) @_field_set&.to_json end |