Class: KlaviyoBeta::SegmentsApi
- Inherits:
-
Object
- Object
- KlaviyoBeta::SegmentsApi
- Defined in:
- lib/klaviyo_sdk_beta/api/segments_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_segment(id, opts = {}) ⇒ Hash<String, Object>
Get Segment Get a single segment by ID
*Rate limits*:
Burst: `10/s`
Steady: `150/m`. -
#get_segment_profiles(segment_id, opts = {}) ⇒ Hash<String, Object>
Get Segment Profiles Returns a list of all profiles inside a given segment, that can optionally be filtered by email, phone number, and push token.
-
#get_segment_profiles_with_http_info(segment_id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Segment Profiles Returns a list of all profiles inside a given segment, that can optionally be filtered by email, phone number, and push token.
-
#get_segment_relationships(id, related_resource, opts = {}) ⇒ Hash<String, Object>
Get Segment Relationships Returns a list of profile membership relationships for a given segment.
-
#get_segment_relationships_with_http_info(id, related_resource, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Segment Relationships Returns a list of profile membership relationships for a given segment.
-
#get_segment_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Segment Get a single segment by ID<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m`.
-
#get_segments(opts = {}) ⇒ Hash<String, Object>
Get Segments Get some or all segments.
*Rate limits*:
Burst: `10/s`
Steady: `150/m`. -
#get_segments_with_http_info(opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Segments Get some or all segments.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m`.
-
#initialize(api_client = ApiClient.default) ⇒ SegmentsApi
constructor
A new instance of SegmentsApi.
-
#update_segment(id, segment_partial_update_query, opts = {}) ⇒ Hash<String, Object>
Update Segment Update segment name or other attributes by ID.
*Rate limits*:
Burst: `10/s`
Steady: `150/m`. -
#update_segment_with_http_info(id, segment_partial_update_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Update Segment Update segment name or other attributes by ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m`.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ SegmentsApi
Returns a new instance of SegmentsApi.
19 20 21 |
# File 'lib/klaviyo_sdk_beta/api/segments_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/klaviyo_sdk_beta/api/segments_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#get_segment(id, opts = {}) ⇒ Hash<String, Object>
Get Segment Get a single segment by ID
*Rate limits*:
Burst: `10/s`
Steady: `150/m`
28 29 30 31 |
# File 'lib/klaviyo_sdk_beta/api/segments_api.rb', line 28 def get_segment(id, opts = {}) data, _status_code, _headers = get_segment_with_http_info(id, opts) data end |
#get_segment_profiles(segment_id, opts = {}) ⇒ Hash<String, Object>
Get Segment Profiles Returns a list of all profiles inside a given segment, that can optionally be filtered by email, phone number, and push token.
101 102 103 104 |
# File 'lib/klaviyo_sdk_beta/api/segments_api.rb', line 101 def get_segment_profiles(segment_id, opts = {}) data, _status_code, _headers = get_segment_profiles_with_http_info(segment_id, opts) data end |
#get_segment_profiles_with_http_info(segment_id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Segment Profiles Returns a list of all profiles inside a given segment, that can optionally be filtered by email, phone number, and push token.
113 114 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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/klaviyo_sdk_beta/api/segments_api.rb', line 113 def get_segment_profiles_with_http_info(segment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.get_segment_profiles ...' end # verify the required parameter 'segment_id' is set if @api_client.config.client_side_validation && segment_id.nil? fail ArgumentError, "Missing the required parameter 'segment_id' when calling SegmentsApi.get_segment_profiles" end # resource path local_var_path = '/api/segments/{segment_id}/profiles/'.sub('{' + 'segment_id' + '}', CGI.escape(segment_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil? query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['API_REVISION'] || "2022-09-07.pre" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] = opts.merge( :operation => :"SegmentsApi.get_segment_profiles", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SegmentsApi#get_segment_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_segment_relationships(id, related_resource, opts = {}) ⇒ Hash<String, Object>
Get Segment Relationships Returns a list of profile membership relationships for a given segment
172 173 174 175 |
# File 'lib/klaviyo_sdk_beta/api/segments_api.rb', line 172 def get_segment_relationships(id, , opts = {}) data, _status_code, _headers = get_segment_relationships_with_http_info(id, , opts) data end |
#get_segment_relationships_with_http_info(id, related_resource, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Segment Relationships Returns a list of profile membership relationships for a given segment
184 185 186 187 188 189 190 191 192 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 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/klaviyo_sdk_beta/api/segments_api.rb', line 184 def get_segment_relationships_with_http_info(id, , opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.get_segment_relationships ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling SegmentsApi.get_segment_relationships" end # verify the required parameter 'related_resource' is set if @api_client.config.client_side_validation && .nil? fail ArgumentError, "Missing the required parameter 'related_resource' when calling SegmentsApi.get_segment_relationships" end # verify enum value allowable_values = ["profiles"] if @api_client.config.client_side_validation && !allowable_values.include?() fail ArgumentError, "invalid value for \"related_resource\", must be one of #{allowable_values}" end # resource path local_var_path = '/api/segments/{id}/relationships/{related_resource}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'related_resource' + '}', CGI.escape(.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['API_REVISION'] || "2022-09-07.pre" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] = opts.merge( :operation => :"SegmentsApi.get_segment_relationships", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SegmentsApi#get_segment_relationships\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_segment_with_http_info(id, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Segment Get a single segment by ID<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m`
39 40 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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/klaviyo_sdk_beta/api/segments_api.rb', line 39 def get_segment_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.get_segment ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling SegmentsApi.get_segment" end allowable_values = ["name", "created", "updated"] if @api_client.config.client_side_validation && opts[:'fields_segment'] && !opts[:'fields_segment'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_segment\", must include one of #{allowable_values}" end # resource path local_var_path = '/api/segments/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'fields[segment]'] = @api_client.build_collection_param(opts[:'fields_segment'], :csv) if !opts[:'fields_segment'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['API_REVISION'] || "2022-09-07.pre" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] = opts.merge( :operation => :"SegmentsApi.get_segment", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SegmentsApi#get_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_segments(opts = {}) ⇒ Hash<String, Object>
Get Segments Get some or all segments.
*Rate limits*:
Burst: `10/s`
Steady: `150/m`
251 252 253 254 |
# File 'lib/klaviyo_sdk_beta/api/segments_api.rb', line 251 def get_segments(opts = {}) data, _status_code, _headers = get_segments_with_http_info(opts) data end |
#get_segments_with_http_info(opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Get Segments Get some or all segments.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m`
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'lib/klaviyo_sdk_beta/api/segments_api.rb', line 263 def get_segments_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.get_segments ...' end allowable_values = ["name", "created", "updated"] if @api_client.config.client_side_validation && opts[:'fields_segment'] && !opts[:'fields_segment'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"fields_segment\", must include one of #{allowable_values}" end # resource path local_var_path = '/api/segments/' # query parameters query_params = opts[:query_params] || {} query_params[:'fields[segment]'] = @api_client.build_collection_param(opts[:'fields_segment'], :csv) if !opts[:'fields_segment'].nil? query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil? query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['API_REVISION'] || "2022-09-07.pre" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] = opts.merge( :operation => :"SegmentsApi.get_segments", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SegmentsApi#get_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_segment(id, segment_partial_update_query, opts = {}) ⇒ Hash<String, Object>
Update Segment Update segment name or other attributes by ID.
*Rate limits*:
Burst: `10/s`
Steady: `150/m`
322 323 324 325 |
# File 'lib/klaviyo_sdk_beta/api/segments_api.rb', line 322 def update_segment(id, segment_partial_update_query, opts = {}) data, _status_code, _headers = update_segment_with_http_info(id, segment_partial_update_query, opts) data end |
#update_segment_with_http_info(id, segment_partial_update_query, opts = {}) ⇒ Array<(Hash<String, Object>, Integer, Hash)>
Update Segment Update segment name or other attributes by ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m`
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
# File 'lib/klaviyo_sdk_beta/api/segments_api.rb', line 333 def update_segment_with_http_info(id, segment_partial_update_query, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.update_segment ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling SegmentsApi.update_segment" end # verify the required parameter 'segment_partial_update_query' is set if @api_client.config.client_side_validation && segment_partial_update_query.nil? fail ArgumentError, "Missing the required parameter 'segment_partial_update_query' when calling SegmentsApi.update_segment" end # resource path local_var_path = '/api/segments/{id}/'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # klaviyo api revision header_params['revision'] = ENV['API_REVISION'] || "2022-09-07.pre" # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(segment_partial_update_query) # return_type return_type = opts[:debug_return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:debug_auth_names] || ['Klaviyo-API-Key'] = opts.merge( :operation => :"SegmentsApi.update_segment", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SegmentsApi#update_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |