Class: NewDemoApiClient::ProductClient
- Inherits:
-
Object
- Object
- NewDemoApiClient::ProductClient
- Defined in:
- lib/test_sdk/product/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#get_cohorts(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) ⇒ Array<NewDemoApiClient::CohortsResponse>
Get the product cohorts for the company associated with the deal.
-
#get_concentration(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) ⇒ NewDemoApiClient::ConcentrationResponse
Get the product concentration for the company associated with the deal.
-
#get_growth_accounting(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) ⇒ Array<NewDemoApiClient::GrowthAccountingResponse>
Get the product growth accounting for the company associated with the deal.
-
#get_user_accounting(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) ⇒ Array<NewDemoApiClient::UserAccountingResponse>
Get the product user accounting for the company associated with the deal.
- #initialize(request_client:) ⇒ NewDemoApiClient::ProductClient constructor
Constructor Details
#initialize(request_client:) ⇒ NewDemoApiClient::ProductClient
20 21 22 |
# File 'lib/test_sdk/product/client.rb', line 20 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ NewDemoApiClient::RequestClient (readonly)
16 17 18 |
# File 'lib/test_sdk/product/client.rb', line 16 def request_client @request_client end |
Instance Method Details
#get_cohorts(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) ⇒ Array<NewDemoApiClient::CohortsResponse>
Get the product cohorts for the company associated with the deal.
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/test_sdk/product/client.rb', line 141 def get_cohorts(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "user_type": user_type, "metric": metric, "freq": freq }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}/deal/#{deal_id}/data/cohorts" end parsed_json = JSON.parse(response.body) parsed_json&.map do |item| item = item.to_json NewDemoApiClient::CohortsResponse.from_json(json_object: item) end end |
#get_concentration(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) ⇒ NewDemoApiClient::ConcentrationResponse
Get the product concentration for the company associated with the deal.
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/test_sdk/product/client.rb', line 189 def get_concentration(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "user_type": user_type, "metric": metric, "freq": freq }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}/deal/#{deal_id}/data/concentration" end NewDemoApiClient::ConcentrationResponse.from_json(json_object: response.body) end |
#get_growth_accounting(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) ⇒ Array<NewDemoApiClient::GrowthAccountingResponse>
Get the product growth accounting for the company associated with the deal.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/test_sdk/product/client.rb', line 93 def get_growth_accounting(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "user_type": user_type, "metric": metric, "freq": freq }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}/deal/#{deal_id}/data/growth-accounting" end parsed_json = JSON.parse(response.body) parsed_json&.map do |item| item = item.to_json NewDemoApiClient::GrowthAccountingResponse.from_json(json_object: item) end end |
#get_user_accounting(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) ⇒ Array<NewDemoApiClient::UserAccountingResponse>
Get the product user accounting for the company associated with the deal.
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 |
# File 'lib/test_sdk/product/client.rb', line 45 def get_user_accounting(group_id:, deal_id:, user_type:, metric:, freq: nil, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "user_type": user_type, "metric": metric, "freq": freq }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}/deal/#{deal_id}/data/user-accounting" end parsed_json = JSON.parse(response.body) parsed_json&.map do |item| item = item.to_json NewDemoApiClient::UserAccountingResponse.from_json(json_object: item) end end |