Class: Whop_sdk::FinancialReports::Breakdown::Client
- Inherits:
-
Object
- Object
- Whop_sdk::FinancialReports::Breakdown::Client
- Defined in:
- lib/whop_sdk/financial_reports/breakdown/client.rb
Instance Method Summary collapse
- #initialize(client:) ⇒ void constructor
-
#retrieve(request_options: {}, **params) ⇒ Whop_sdk::FinancialReports::Breakdown::Types::RetrieveBreakdownResponse
Returns the top entities behind one high-level financial report bucket and an aggregate remainder.
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/whop_sdk/financial_reports/breakdown/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#retrieve(request_options: {}, **params) ⇒ Whop_sdk::FinancialReports::Breakdown::Types::RetrieveBreakdownResponse
Returns the top entities behind one high-level financial report bucket and an aggregate remainder.
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/financial_reports/breakdown/client.rb', line 43 def retrieve(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["bucket"] = params[:bucket] if params.key?(:bucket) query_params["direction"] = params[:direction] if params.key?(:direction) query_params["currency"] = params[:currency] if params.key?(:currency) query_params["from"] = params[:from] if params.key?(:from) query_params["to"] = params[:to] if params.key?(:to) query_params["group_by"] = params[:group_by] if params.key?(:group_by) query_params["timezone"] = params[:timezone] if params.key?(:timezone) request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "financial_reports/breakdown", 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::FinancialReports::Breakdown::Types::RetrieveBreakdownResponse.load(response.body) else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |