Class: PinterestSdkClient::AudienceInsightsApi
- Inherits:
-
Object
- Object
- PinterestSdkClient::AudienceInsightsApi
- Defined in:
- lib/pinterest_sdk/api/audience_insights_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#audience_insights_get(ad_account_id, audience_insight_type, opts = {}) ⇒ AudienceInsights
Get audience insights Get Audience Insights for an ad account.
-
#audience_insights_get_with_http_info(ad_account_id, audience_insight_type, opts = {}) ⇒ Array<(AudienceInsights, Integer, Hash)>
Get audience insights Get Audience Insights for an ad account.
-
#audience_insights_scope_and_type_get(ad_account_id, opts = {}) ⇒ AudienceInsightsScopeAndTypeGet200Response
Get audience insights scope and type Get the scope and type of available audiences, which along with a date, is an audience that has recently had an interaction (referred to here as a type) on pins.
-
#audience_insights_scope_and_type_get_with_http_info(ad_account_id, opts = {}) ⇒ Array<(AudienceInsightsScopeAndTypeGet200Response, Integer, Hash)>
Get audience insights scope and type Get the scope and type of available audiences, which along with a date, is an audience that has recently had an interaction (referred to here as a type) on pins.
-
#initialize(api_client = ApiClient.default) ⇒ AudienceInsightsApi
constructor
A new instance of AudienceInsightsApi.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ AudienceInsightsApi
Returns a new instance of AudienceInsightsApi.
19 20 21 |
# File 'lib/pinterest_sdk/api/audience_insights_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/pinterest_sdk/api/audience_insights_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#audience_insights_get(ad_account_id, audience_insight_type, opts = {}) ⇒ AudienceInsights
Get audience insights Get Audience Insights for an ad account. The response will return insights for 3 types of audiences: the ad account's engaged audience on Pinterest, the ad account's total audience on Pinterest and Pinterest's total audience. Learn more about Audience Insights.
28 29 30 31 |
# File 'lib/pinterest_sdk/api/audience_insights_api.rb', line 28 def audience_insights_get(ad_account_id, audience_insight_type, opts = {}) data, _status_code, _headers = audience_insights_get_with_http_info(ad_account_id, audience_insight_type, opts) data end |
#audience_insights_get_with_http_info(ad_account_id, audience_insight_type, opts = {}) ⇒ Array<(AudienceInsights, Integer, Hash)>
Get audience insights Get Audience Insights for an ad account. The response will return insights for 3 types of audiences: the ad account's engaged audience on Pinterest, the ad account's total audience on Pinterest and Pinterest's total audience. Learn more about Audience Insights.
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 93 94 95 96 97 98 99 |
# File 'lib/pinterest_sdk/api/audience_insights_api.rb', line 39 def audience_insights_get_with_http_info(ad_account_id, audience_insight_type, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AudienceInsightsApi.audience_insights_get ...' end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AudienceInsightsApi.audience_insights_get" end if @api_client.config.client_side_validation && ad_account_id.to_s.length > 18 fail ArgumentError, 'invalid value for "ad_account_id" when calling AudienceInsightsApi.audience_insights_get, the character length must be smaller than or equal to 18.' end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_account_id !~ pattern fail ArgumentError, "invalid value for 'ad_account_id' when calling AudienceInsightsApi.audience_insights_get, must conform to the pattern #{pattern}." end # verify the required parameter 'audience_insight_type' is set if @api_client.config.client_side_validation && audience_insight_type.nil? fail ArgumentError, "Missing the required parameter 'audience_insight_type' when calling AudienceInsightsApi.audience_insights_get" end # resource path local_var_path = '/ad_accounts/{ad_account_id}/audience_insights'.sub('{ad_account_id}', CGI.escape(ad_account_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'audience_insight_type'] = audience_insight_type # 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] || 'AudienceInsights' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2', 'client_credentials'] = opts.merge( :operation => :"AudienceInsightsApi.audience_insights_get", :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: AudienceInsightsApi#audience_insights_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#audience_insights_scope_and_type_get(ad_account_id, opts = {}) ⇒ AudienceInsightsScopeAndTypeGet200Response
Get audience insights scope and type Get the scope and type of available audiences, which along with a date, is an audience that has recently had an interaction (referred to here as a type) on pins. Interacted pins can belong to at least the most common partner or Pinterest scopes. This means that user interactions made on advertiser or partner pins will have the partner scope. You can also have user interactions performed in general on Pinterest with the Pinterest scope. In that case, you can then use the returned type and scope values together on requests to other endpoints to retrieve insight metrics for a desired audience.
106 107 108 109 |
# File 'lib/pinterest_sdk/api/audience_insights_api.rb', line 106 def audience_insights_scope_and_type_get(ad_account_id, opts = {}) data, _status_code, _headers = audience_insights_scope_and_type_get_with_http_info(ad_account_id, opts) data end |
#audience_insights_scope_and_type_get_with_http_info(ad_account_id, opts = {}) ⇒ Array<(AudienceInsightsScopeAndTypeGet200Response, Integer, Hash)>
Get audience insights scope and type Get the scope and type of available audiences, which along with a date, is an audience that has recently had an interaction (referred to here as a type) on pins. Interacted pins can belong to at least the most common partner or Pinterest scopes. This means that user interactions made on advertiser or partner pins will have the partner scope. You can also have user interactions performed in general on Pinterest with the Pinterest scope. In that case, you can then use the returned type and scope values together on requests to other endpoints to retrieve insight metrics for a desired audience.
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 164 165 166 167 168 169 170 171 |
# File 'lib/pinterest_sdk/api/audience_insights_api.rb', line 116 def audience_insights_scope_and_type_get_with_http_info(ad_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AudienceInsightsApi.audience_insights_scope_and_type_get ...' end # verify the required parameter 'ad_account_id' is set if @api_client.config.client_side_validation && ad_account_id.nil? fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AudienceInsightsApi.audience_insights_scope_and_type_get" end if @api_client.config.client_side_validation && ad_account_id.to_s.length > 18 fail ArgumentError, 'invalid value for "ad_account_id" when calling AudienceInsightsApi.audience_insights_scope_and_type_get, the character length must be smaller than or equal to 18.' end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && ad_account_id !~ pattern fail ArgumentError, "invalid value for 'ad_account_id' when calling AudienceInsightsApi.audience_insights_scope_and_type_get, must conform to the pattern #{pattern}." end # resource path local_var_path = '/ad_accounts/{ad_account_id}/insights/audiences'.sub('{ad_account_id}', CGI.escape(ad_account_id.to_s)) # query parameters query_params = opts[:query_params] || {} # 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] || 'AudienceInsightsScopeAndTypeGet200Response' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2', 'client_credentials'] = opts.merge( :operation => :"AudienceInsightsApi.audience_insights_scope_and_type_get", :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: AudienceInsightsApi#audience_insights_scope_and_type_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |