Class: PinterestSdkClient::TrendsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pinterest_sdk/api/trends_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TrendsApi

Returns a new instance of TrendsApi.



19
20
21
# File 'lib/pinterest_sdk/api/trends_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/pinterest_sdk/api/trends_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

Returns editorial articles for a given region Get a list of published editorial articles. Translations of the editorials will be provided if available; otherwise, the default language will be English.

Parameters:

  • region (ProductCategoryRegion)

    The geographic region of interest. Only top product categories within the specified region will be returned. The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`. - `US` - United States - `GB+IE` - Great Britain & Ireland - `CA` - Canada

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/pinterest_sdk/api/trends_api.rb', line 27

def trends_editorial_articles_list(region, opts = {})
  data, _status_code, _headers = trends_editorial_articles_list_with_http_info(region, opts)
  data
end

Returns editorial articles for a given region Get a list of published editorial articles. Translations of the editorials will be provided if available; otherwise, the default language will be English.

Parameters:

  • region (ProductCategoryRegion)

    The geographic region of interest. Only top product categories within the specified region will be returned. The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`. - `US` - United States - `GB+IE` - Great Britain & Ireland - `CA` - Canada

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Array<TrendsEditorial>, Integer, Hash)>)

    Array data, response status code and response headers



37
38
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
# File 'lib/pinterest_sdk/api/trends_api.rb', line 37

def trends_editorial_articles_list_with_http_info(region, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrendsApi.trends_editorial_articles_list ...'
  end
  # verify the required parameter 'region' is set
  if @api_client.config.client_side_validation && region.nil?
    fail ArgumentError, "Missing the required parameter 'region' when calling TrendsApi.trends_editorial_articles_list"
  end
  # resource path
  local_var_path = '/trends/editorial_articles'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'region'] = region

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<TrendsEditorial>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

  new_options = opts.merge(
    :operation => :"TrendsApi.trends_editorial_articles_list",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TrendsApi#trends_editorial_articles_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

Get featured topics Enables advertisers to pull top five trending topics by interest and market, at full parity with the Pinterest Trends UI.

Parameters:

  • region (ProductCategoryRegion)

    The geographic region of interest. Only top product categories within the specified region will be returned. The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`. - `US` - United States - `GB+IE` - Great Britain & Ireland - `CA` - Canada

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



92
93
94
95
# File 'lib/pinterest_sdk/api/trends_api.rb', line 92

def trends_featured_topics_list(region, opts = {})
  data, _status_code, _headers = trends_featured_topics_list_with_http_info(region, opts)
  data
end

Get featured topics Enables advertisers to pull top five trending topics by interest and market, at full parity with the Pinterest Trends UI.

Parameters:

  • region (ProductCategoryRegion)

    The geographic region of interest. Only top product categories within the specified region will be returned. The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`. - `US` - United States - `GB+IE` - Great Britain & Ireland - `CA` - Canada

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(Array<FeaturedTrend>, Integer, Hash)>)

    Array data, response status code and response headers



103
104
105
106
107
108
109
110
111
112
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
# File 'lib/pinterest_sdk/api/trends_api.rb', line 103

def trends_featured_topics_list_with_http_info(region, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrendsApi.trends_featured_topics_list ...'
  end
  # verify the required parameter 'region' is set
  if @api_client.config.client_side_validation && region.nil?
    fail ArgumentError, "Missing the required parameter 'region' when calling TrendsApi.trends_featured_topics_list"
  end
  # resource path
  local_var_path = '/trends/topics/featured'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'region'] = region
  query_params[:'interest'] = opts[:'interest'] if !opts[:'interest'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<FeaturedTrend>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2', 'client_credentials']

  new_options = opts.merge(
    :operation => :"TrendsApi.trends_featured_topics_list",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TrendsApi#trends_featured_topics_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

Get product category details Enables advertisers to retrieve demographic information, related pins, and trend lines for specified product categories

Parameters:

  • product_categories (Array<ProductCategoryEnum>)

    List of product categories

  • region (ProductCategoryRegion)

    The geographic region of interest. Only top product categories within the specified region will be returned. The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`. - `US` - United States - `GB+IE` - Great Britain & Ireland - `CA` - Canada

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :lookback_window (ProductCategoryDetailLookbackWindow)

    Time period for historical data analysis in days. The lookback window defines how far back in time the API will analyze data to compute trend metrics. - `90` - Last 90 days (3 months) - `180` - Last 180 days (6 months) - `365` - Last 365 days (1 year) - `730` - Last 730 days (2 years)

  • :engagement_type (ProductCategoriesEngagementType)

    Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves

Returns:



161
162
163
164
# File 'lib/pinterest_sdk/api/trends_api.rb', line 161

def trends_product_categories_details_list(product_categories, region, opts = {})
  data, _status_code, _headers = trends_product_categories_details_list_with_http_info(product_categories, region, opts)
  data
end

Get product category details Enables advertisers to retrieve demographic information, related pins, and trend lines for specified product categories

Parameters:

  • product_categories (Array<ProductCategoryEnum>)

    List of product categories

  • region (ProductCategoryRegion)

    The geographic region of interest. Only top product categories within the specified region will be returned. The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`. - `US` - United States - `GB+IE` - Great Britain & Ireland - `CA` - Canada

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :lookback_window (ProductCategoryDetailLookbackWindow)

    Time period for historical data analysis in days. The lookback window defines how far back in time the API will analyze data to compute trend metrics. - `90` - Last 90 days (3 months) - `180` - Last 180 days (6 months) - `365` - Last 365 days (1 year) - `730` - Last 730 days (2 years)

  • :engagement_type (ProductCategoriesEngagementType)

    Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves

Returns:

  • (Array<(Array<ProductCategoryDetails>, Integer, Hash)>)

    Array data, response status code and response headers



174
175
176
177
178
179
180
181
182
183
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
# File 'lib/pinterest_sdk/api/trends_api.rb', line 174

def trends_product_categories_details_list_with_http_info(product_categories, region, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrendsApi.trends_product_categories_details_list ...'
  end
  # verify the required parameter 'product_categories' is set
  if @api_client.config.client_side_validation && product_categories.nil?
    fail ArgumentError, "Missing the required parameter 'product_categories' when calling TrendsApi.trends_product_categories_details_list"
  end
  if @api_client.config.client_side_validation && product_categories.length > 20
    fail ArgumentError, 'invalid value for "product_categories" when calling TrendsApi.trends_product_categories_details_list, number of items must be less than or equal to 20.'
  end

  if @api_client.config.client_side_validation && product_categories.length < 1
    fail ArgumentError, 'invalid value for "product_categories" when calling TrendsApi.trends_product_categories_details_list, number of items must be greater than or equal to 1.'
  end

  # verify the required parameter 'region' is set
  if @api_client.config.client_side_validation && region.nil?
    fail ArgumentError, "Missing the required parameter 'region' when calling TrendsApi.trends_product_categories_details_list"
  end
  # resource path
  local_var_path = '/trends/product_categories/details'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'product_categories'] = @api_client.build_collection_param(product_categories, :multi)
  query_params[:'region'] = region
  query_params[:'lookback_window'] = opts[:'lookback_window'] if !opts[:'lookback_window'].nil?
  query_params[:'engagement_type'] = opts[:'engagement_type'] if !opts[:'engagement_type'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<ProductCategoryDetails>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2', 'client_credentials']

  new_options = opts.merge(
    :operation => :"TrendsApi.trends_product_categories_details_list",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TrendsApi#trends_product_categories_details_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

Get a list of growing Shopping Product Categories Get a list of growing Shopping Product Categories in ranked order allowing filtering by engagement type, vertical, age, and gender.

Parameters:

  • region (ProductCategoryRegion)

    The geographic region of interest. Only top product categories within the specified region will be returned. The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`. - `US` - United States - `GB+IE` - Great Britain & Ireland - `CA` - Canada

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :verticals (Array<VerticalProductCategory>)

    List of verticals to filter by

  • :ages (Array<AgeTrendsBucket>)

    Age to filter by. If not provided, the results will be filtered by all ages.

  • :genders (Array<GenderBucket>)

    Gender to filter by, If not provided, the results will be filtered by all genders.

  • :engagement_type (ProductCategoriesEngagementType)

    Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves

Returns:



247
248
249
250
# File 'lib/pinterest_sdk/api/trends_api.rb', line 247

def trends_product_categories_trending_list(region, opts = {})
  data, _status_code, _headers = trends_product_categories_trending_list_with_http_info(region, opts)
  data
end

Get a list of growing Shopping Product Categories Get a list of growing Shopping Product Categories in ranked order allowing filtering by engagement type, vertical, age, and gender.

Parameters:

  • region (ProductCategoryRegion)

    The geographic region of interest. Only top product categories within the specified region will be returned. The `region` parameter is formatted as ISO 3166-2 country codes delimited by `+`. - `US` - United States - `GB+IE` - Great Britain & Ireland - `CA` - Canada

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :verticals (Array<VerticalProductCategory>)

    List of verticals to filter by

  • :ages (Array<AgeTrendsBucket>)

    Age to filter by. If not provided, the results will be filtered by all ages.

  • :genders (Array<GenderBucket>)

    Gender to filter by, If not provided, the results will be filtered by all genders.

  • :engagement_type (ProductCategoriesEngagementType)

    Type of engagement metric to analyze. - `ENGAGEMENT` - Overall engagement metric - `OUTBOUND_CLICK` - Number of outbound clicks - `SAVE` - Number of pin saves

Returns:

  • (Array<(Array<TrendingProductCategory>, Integer, Hash)>)

    Array data, response status code and response headers



261
262
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
# File 'lib/pinterest_sdk/api/trends_api.rb', line 261

def trends_product_categories_trending_list_with_http_info(region, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TrendsApi.trends_product_categories_trending_list ...'
  end
  # verify the required parameter 'region' is set
  if @api_client.config.client_side_validation && region.nil?
    fail ArgumentError, "Missing the required parameter 'region' when calling TrendsApi.trends_product_categories_trending_list"
  end
  # resource path
  local_var_path = '/trends/product_categories/trending'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'region'] = region
  query_params[:'verticals'] = @api_client.build_collection_param(opts[:'verticals'], :multi) if !opts[:'verticals'].nil?
  query_params[:'ages'] = @api_client.build_collection_param(opts[:'ages'], :multi) if !opts[:'ages'].nil?
  query_params[:'genders'] = @api_client.build_collection_param(opts[:'genders'], :multi) if !opts[:'genders'].nil?
  query_params[:'engagement_type'] = opts[:'engagement_type'] if !opts[:'engagement_type'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<TrendingProductCategory>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2', 'client_credentials']

  new_options = opts.merge(
    :operation => :"TrendsApi.trends_product_categories_trending_list",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TrendsApi#trends_product_categories_trending_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end