Class: Whop_sdk::Ledgers::Client
- Inherits:
-
Object
- Object
- Whop_sdk::Ledgers::Client
- Defined in:
- lib/whop_sdk/ledgers/client.rb
Instance Method Summary collapse
-
#get_financial_report(request_options: {}, **params) ⇒ Whop_sdk::Ledgers::Types::GetFinancialReportResponse
Returns a financial report — balance activity, income statement, or balance summary — for an account over a date range.
- #initialize(client:) ⇒ void constructor
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/whop_sdk/ledgers/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#get_financial_report(request_options: {}, **params) ⇒ Whop_sdk::Ledgers::Types::GetFinancialReportResponse
Returns a financial report — balance activity, income statement, or balance summary — for an account over a date range.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/whop_sdk/ledgers/client.rb', line 41 def get_financial_report(request_options: {}, **params) params = Whop_sdk::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["account_id"] = params[:account_id] if params.key?(:account_id) query_params["report_type"] = params[:report_type] if params.key?(:report_type) query_params["currency"] = params[:currency] if params.key?(:currency) query_params["in_currency"] = params[:in_currency] if params.key?(:in_currency) query_params["from_date"] = params[:from_date] if params.key?(:from_date) query_params["to_date"] = params[:to_date] if params.key?(:to_date) query_params["group_by"] = params[:group_by] if params.key?(:group_by) query_params["timezone"] = params[:timezone] if params.key?(:timezone) query_params["cumulative"] = params[:cumulative] if params.key?(:cumulative) query_params["scope_account_id"] = params[:scope_account_id] if params.key?(:scope_account_id) request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "financial_reports", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Whop_sdk::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Whop_sdk::Ledgers::Types::GetFinancialReportResponse.load(response.body) else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |