Class: Schematic::Insights::Client
- Inherits:
-
Object
- Object
- Schematic::Insights::Client
- Defined in:
- lib/schematic/insights/client.rb
Instance Method Summary collapse
- #get_activity(request_options: {}, **params) ⇒ Schematic::Insights::Types::GetActivityResponse
- #get_environment_feature_usage_time_series(request_options: {}, **params) ⇒ Schematic::Insights::Types::GetEnvironmentFeatureUsageTimeSeriesResponse
- #get_environment_trait_usage_time_series(request_options: {}, **params) ⇒ Schematic::Insights::Types::GetEnvironmentTraitUsageTimeSeriesResponse
- #get_plan_growth(request_options: {}, **params) ⇒ Schematic::Insights::Types::GetPlanGrowthResponse
- #get_summary(request_options: {}, **_params) ⇒ Schematic::Insights::Types::GetSummaryResponse
- #get_top_features_by_usage(request_options: {}, **params) ⇒ Schematic::Insights::Types::GetTopFeaturesByUsageResponse
- #initialize(client:) ⇒ void constructor
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/schematic/insights/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#get_activity(request_options: {}, **params) ⇒ Schematic::Insights::Types::GetActivityResponse
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/schematic/insights/client.rb', line 26 def get_activity(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["limit"] = params[:limit] if params.key?(:limit) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "insights/activity", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Insights::Types::GetActivityResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_environment_feature_usage_time_series(request_options: {}, **params) ⇒ Schematic::Insights::Types::GetEnvironmentFeatureUsageTimeSeriesResponse
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/schematic/insights/client.rb', line 73 def get_environment_feature_usage_time_series(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["end_time"] = params[:end_time] if params.key?(:end_time) query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id) query_params["granularity"] = params[:granularity] if params.key?(:granularity) query_params["start_time"] = params[:start_time] if params.key?(:start_time) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "insights/feature-usage-timeseries", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Insights::Types::GetEnvironmentFeatureUsageTimeSeriesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_environment_trait_usage_time_series(request_options: {}, **params) ⇒ Schematic::Insights::Types::GetEnvironmentTraitUsageTimeSeriesResponse
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/schematic/insights/client.rb', line 242 def get_environment_trait_usage_time_series(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["end_time"] = params[:end_time] if params.key?(:end_time) query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id) query_params["granularity"] = params[:granularity] if params.key?(:granularity) query_params["start_time"] = params[:start_time] if params.key?(:start_time) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "insights/trait-usage-timeseries", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Insights::Types::GetEnvironmentTraitUsageTimeSeriesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_plan_growth(request_options: {}, **params) ⇒ Schematic::Insights::Types::GetPlanGrowthResponse
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/schematic/insights/client.rb', line 115 def get_plan_growth(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["months"] = params[:months] if params.key?(:months) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "insights/plan-growth", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Insights::Types::GetPlanGrowthResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_summary(request_options: {}, **_params) ⇒ Schematic::Insights::Types::GetSummaryResponse
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/schematic/insights/client.rb', line 153 def get_summary(request_options: {}, **_params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "insights/summary", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Insights::Types::GetSummaryResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_top_features_by_usage(request_options: {}, **params) ⇒ Schematic::Insights::Types::GetTopFeaturesByUsageResponse
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/schematic/insights/client.rb', line 193 def get_top_features_by_usage(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["end_time"] = params[:end_time] if params.key?(:end_time) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["start_time"] = params[:start_time] if params.key?(:start_time) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "insights/top-features", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Schematic::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Schematic::Insights::Types::GetTopFeaturesByUsageResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |