Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 18 additions & 4 deletions lib/merge_ruby_client/accounting/accounting_periods/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ def initialize(request_client:)
# Returns a list of `AccountingPeriod` objects.
#
# @param cursor [String] The pagination cursor value.
# @param include_deleted_data [Boolean] Whether to include data that was marked as deleted by third party webhooks.
# @param include_deleted_data [Boolean] Indicates whether or not this object has been deleted in the third party
# platform. Full coverage deletion detection is a premium add-on. Native deletion
# detection is offered for free with limited coverage. [Learn
# more](https://docs.merge.dev/integrations/hris/supported-features/).
# @param include_remote_data [Boolean] Whether to include the original data Merge fetched from the third-party to
# produce these models.
# @param include_shell_data [Boolean] Whether to include shell records. Shell records are empty records (they may
# contain some metadata but all other fields are null).
# @param page_size [Integer] Number of results to return per page.
# @param request_options [Merge::RequestOptions]
# @return [Merge::Accounting::PaginatedAccountingPeriodList]
Expand All @@ -33,7 +38,8 @@ def initialize(request_client:)
# api_key: "YOUR_AUTH_TOKEN"
# )
# api.accounting.accounting_periods.list
def list(cursor: nil, include_deleted_data: nil, include_remote_data: nil, page_size: nil, request_options: nil)
def list(cursor: nil, include_deleted_data: nil, include_remote_data: nil, include_shell_data: nil,
page_size: nil, request_options: nil)
response = @request_client.conn.get do |req|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
Expand All @@ -48,6 +54,7 @@ def list(cursor: nil, include_deleted_data: nil, include_remote_data: nil, page_
"cursor": cursor,
"include_deleted_data": include_deleted_data,
"include_remote_data": include_remote_data,
"include_shell_data": include_shell_data,
"page_size": page_size
}.compact
unless request_options.nil? || request_options&.additional_body_parameters.nil?
Expand Down Expand Up @@ -108,9 +115,14 @@ def initialize(request_client:)
# Returns a list of `AccountingPeriod` objects.
#
# @param cursor [String] The pagination cursor value.
# @param include_deleted_data [Boolean] Whether to include data that was marked as deleted by third party webhooks.
# @param include_deleted_data [Boolean] Indicates whether or not this object has been deleted in the third party
# platform. Full coverage deletion detection is a premium add-on. Native deletion
# detection is offered for free with limited coverage. [Learn
# more](https://docs.merge.dev/integrations/hris/supported-features/).
# @param include_remote_data [Boolean] Whether to include the original data Merge fetched from the third-party to
# produce these models.
# @param include_shell_data [Boolean] Whether to include shell records. Shell records are empty records (they may
# contain some metadata but all other fields are null).
# @param page_size [Integer] Number of results to return per page.
# @param request_options [Merge::RequestOptions]
# @return [Merge::Accounting::PaginatedAccountingPeriodList]
Expand All @@ -121,7 +133,8 @@ def initialize(request_client:)
# api_key: "YOUR_AUTH_TOKEN"
# )
# api.accounting.accounting_periods.list
def list(cursor: nil, include_deleted_data: nil, include_remote_data: nil, page_size: nil, request_options: nil)
def list(cursor: nil, include_deleted_data: nil, include_remote_data: nil, include_shell_data: nil,
page_size: nil, request_options: nil)
Async do
response = @request_client.conn.get do |req|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
Expand All @@ -137,6 +150,7 @@ def list(cursor: nil, include_deleted_data: nil, include_remote_data: nil, page_
"cursor": cursor,
"include_deleted_data": include_deleted_data,
"include_remote_data": include_remote_data,
"include_shell_data": include_shell_data,
"page_size": page_size
}.compact
unless request_options.nil? || request_options&.additional_body_parameters.nil?
Expand Down
34 changes: 26 additions & 8 deletions lib/merge_ruby_client/accounting/accounts/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,21 @@ def initialize(request_client:)

# Returns a list of `Account` objects.
#
# @param account_type [String] If provided, will only provide accounts with the passed in enum.
# @param company_id [String] If provided, will only return accounts for this company.
# @param created_after [DateTime] If provided, will only return objects created after this datetime.
# @param created_before [DateTime] If provided, will only return objects created before this datetime.
# @param cursor [String] The pagination cursor value.
# @param expand [String] Which relations should be returned in expanded form. Multiple relation names
# should be comma separated without spaces.
# @param include_deleted_data [Boolean] Whether to include data that was marked as deleted by third party webhooks.
# @param include_deleted_data [Boolean] Indicates whether or not this object has been deleted in the third party
# platform. Full coverage deletion detection is a premium add-on. Native deletion
# detection is offered for free with limited coverage. [Learn
# more](https://docs.merge.dev/integrations/hris/supported-features/).
# @param include_remote_data [Boolean] Whether to include the original data Merge fetched from the third-party to
# produce these models.
# @param include_shell_data [Boolean] Whether to include shell records. Shell records are empty records (they may
# contain some metadata but all other fields are null).
# @param modified_after [DateTime] If provided, only objects synced by Merge after this date time will be returned.
# @param modified_before [DateTime] If provided, only objects synced by Merge before this date time will be
# returned.
Expand All @@ -54,8 +60,8 @@ def initialize(request_client:)
# api_key: "YOUR_AUTH_TOKEN"
# )
# api.accounting.accounts.list
def list(company_id: nil, created_after: nil, created_before: nil, cursor: nil, expand: nil,
include_deleted_data: nil, include_remote_data: nil, modified_after: nil, modified_before: nil, page_size: nil, remote_fields: nil, remote_id: nil, show_enum_origins: nil, request_options: nil)
def list(account_type: nil, company_id: nil, created_after: nil, created_before: nil, cursor: nil, expand: nil,
include_deleted_data: nil, include_remote_data: nil, include_shell_data: nil, modified_after: nil, modified_before: nil, page_size: nil, remote_fields: nil, remote_id: nil, show_enum_origins: nil, request_options: nil)
response = @request_client.conn.get do |req|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
Expand All @@ -67,13 +73,15 @@ def list(company_id: nil, created_after: nil, created_before: nil, cursor: nil,
}.compact
req.params = {
**(request_options&.additional_query_parameters || {}),
"account_type": account_type,
"company_id": company_id,
"created_after": created_after,
"created_before": created_before,
"cursor": cursor,
"expand": expand,
"include_deleted_data": include_deleted_data,
"include_remote_data": include_remote_data,
"include_shell_data": include_shell_data,
"modified_after": modified_after,
"modified_before": modified_before,
"page_size": page_size,
Expand All @@ -98,9 +106,10 @@ def list(company_id: nil, created_after: nil, created_before: nil, cursor: nil,
# * :description (String)
# * :classification (Merge::Accounting::ClassificationEnum)
# * :type (String)
# * :account_type (Merge::Accounting::AccountAccountTypeEnum)
# * :status (Merge::Accounting::AccountStatusEnum)
# * :current_balance (Float)
# * :currency (Merge::Accounting::CurrencyEnum)
# * :currency (Merge::Accounting::TransactionCurrencyEnum)
# * :account_number (String)
# * :parent_account (String)
# * :company (String)
Expand Down Expand Up @@ -227,15 +236,21 @@ def initialize(request_client:)

# Returns a list of `Account` objects.
#
# @param account_type [String] If provided, will only provide accounts with the passed in enum.
# @param company_id [String] If provided, will only return accounts for this company.
# @param created_after [DateTime] If provided, will only return objects created after this datetime.
# @param created_before [DateTime] If provided, will only return objects created before this datetime.
# @param cursor [String] The pagination cursor value.
# @param expand [String] Which relations should be returned in expanded form. Multiple relation names
# should be comma separated without spaces.
# @param include_deleted_data [Boolean] Whether to include data that was marked as deleted by third party webhooks.
# @param include_deleted_data [Boolean] Indicates whether or not this object has been deleted in the third party
# platform. Full coverage deletion detection is a premium add-on. Native deletion
# detection is offered for free with limited coverage. [Learn
# more](https://docs.merge.dev/integrations/hris/supported-features/).
# @param include_remote_data [Boolean] Whether to include the original data Merge fetched from the third-party to
# produce these models.
# @param include_shell_data [Boolean] Whether to include shell records. Shell records are empty records (they may
# contain some metadata but all other fields are null).
# @param modified_after [DateTime] If provided, only objects synced by Merge after this date time will be returned.
# @param modified_before [DateTime] If provided, only objects synced by Merge before this date time will be
# returned.
Expand All @@ -254,8 +269,8 @@ def initialize(request_client:)
# api_key: "YOUR_AUTH_TOKEN"
# )
# api.accounting.accounts.list
def list(company_id: nil, created_after: nil, created_before: nil, cursor: nil, expand: nil,
include_deleted_data: nil, include_remote_data: nil, modified_after: nil, modified_before: nil, page_size: nil, remote_fields: nil, remote_id: nil, show_enum_origins: nil, request_options: nil)
def list(account_type: nil, company_id: nil, created_after: nil, created_before: nil, cursor: nil, expand: nil,
include_deleted_data: nil, include_remote_data: nil, include_shell_data: nil, modified_after: nil, modified_before: nil, page_size: nil, remote_fields: nil, remote_id: nil, show_enum_origins: nil, request_options: nil)
Async do
response = @request_client.conn.get do |req|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
Expand All @@ -268,13 +283,15 @@ def list(company_id: nil, created_after: nil, created_before: nil, cursor: nil,
}.compact
req.params = {
**(request_options&.additional_query_parameters || {}),
"account_type": account_type,
"company_id": company_id,
"created_after": created_after,
"created_before": created_before,
"cursor": cursor,
"expand": expand,
"include_deleted_data": include_deleted_data,
"include_remote_data": include_remote_data,
"include_shell_data": include_shell_data,
"modified_after": modified_after,
"modified_before": modified_before,
"page_size": page_size,
Expand All @@ -300,9 +317,10 @@ def list(company_id: nil, created_after: nil, created_before: nil, cursor: nil,
# * :description (String)
# * :classification (Merge::Accounting::ClassificationEnum)
# * :type (String)
# * :account_type (Merge::Accounting::AccountAccountTypeEnum)
# * :status (Merge::Accounting::AccountStatusEnum)
# * :current_balance (Float)
# * :currency (Merge::Accounting::CurrencyEnum)
# * :currency (Merge::Accounting::TransactionCurrencyEnum)
# * :account_number (String)
# * :parent_account (String)
# * :company (String)
Expand Down
10 changes: 5 additions & 5 deletions lib/merge_ruby_client/accounting/async_passthrough/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_relative "../../../requests"
require_relative "../types/data_passthrough_request"
require_relative "../types/async_passthrough_reciept"
require_relative "../types/remote_response"
require_relative "types/async_passthrough_retrieve_response"
require "async"

module Merge
Expand Down Expand Up @@ -61,7 +61,7 @@ def create(request:, request_options: nil)
#
# @param async_passthrough_receipt_id [String]
# @param request_options [Merge::RequestOptions]
# @return [Merge::Accounting::RemoteResponse]
# @return [Merge::Accounting::RemoteResponse, String]
# @example
# api = Merge::Client.new(
# base_url: "https://api.example.com",
Expand All @@ -87,7 +87,7 @@ def retrieve(async_passthrough_receipt_id:, request_options: nil)
end
req.url "#{@request_client.get_url(request_options: request_options)}/accounting/v1/async-passthrough/#{async_passthrough_receipt_id}"
end
Merge::Accounting::RemoteResponse.from_json(json_object: response.body)
Merge::Accounting::AsyncPassthrough::AsyncPassthroughRetrieveResponse.from_json(json_object: response.body)
end
end

Expand Down Expand Up @@ -146,7 +146,7 @@ def create(request:, request_options: nil)
#
# @param async_passthrough_receipt_id [String]
# @param request_options [Merge::RequestOptions]
# @return [Merge::Accounting::RemoteResponse]
# @return [Merge::Accounting::RemoteResponse, String]
# @example
# api = Merge::Client.new(
# base_url: "https://api.example.com",
Expand All @@ -173,7 +173,7 @@ def retrieve(async_passthrough_receipt_id:, request_options: nil)
end
req.url "#{@request_client.get_url(request_options: request_options)}/accounting/v1/async-passthrough/#{async_passthrough_receipt_id}"
end
Merge::Accounting::RemoteResponse.from_json(json_object: response.body)
Merge::Accounting::AsyncPassthrough::AsyncPassthroughRetrieveResponse.from_json(json_object: response.body)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# frozen_string_literal: true

require "json"
require_relative "../../types/remote_response"

module Merge
module Accounting
class AsyncPassthrough
class AsyncPassthroughRetrieveResponse
# Deserialize a JSON object to an instance of AsyncPassthroughRetrieveResponse
#
# @param json_object [String]
# @return [Merge::Accounting::AsyncPassthrough::AsyncPassthroughRetrieveResponse]
def self.from_json(json_object:)
struct = JSON.parse(json_object, object_class: OpenStruct)
begin
Merge::Accounting::RemoteResponse.validate_raw(obj: struct)
return Merge::Accounting::RemoteResponse.from_json(json_object: struct) unless struct.nil?

return nil
rescue StandardError
# noop
end
begin
struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.")
return struct unless struct.nil?

return nil
rescue StandardError
# noop
end
struct
end

# 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.
#
# @param obj [Object]
# @return [Void]
def self.validate_raw(obj:)
begin
return Merge::Accounting::RemoteResponse.validate_raw(obj: obj)
rescue StandardError
# noop
end
begin
return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.")
rescue StandardError
# noop
end
raise("Passed value matched no type within the union, validation failed.")
end
end
end
end
end
Loading