Class: Zernio::InstagramApi
- Inherits:
-
Object
- Object
- Zernio::InstagramApi
- Defined in:
- lib/zernio-sdk/api/instagram_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_instagram_publishing_limit(account_id, opts = {}) ⇒ GetInstagramPublishingLimit200Response
Get Instagram publishing limit Returns the account's remaining content-publishing quota for Instagram's rolling 24-hour window, so you can pace publishing and warn before the cap is reached.
-
#get_instagram_publishing_limit_with_http_info(account_id, opts = {}) ⇒ Array<(GetInstagramPublishingLimit200Response, Integer, Hash)>
Get Instagram publishing limit Returns the account's remaining content-publishing quota for Instagram's rolling 24-hour window, so you can pace publishing and warn before the cap is reached.
-
#get_instagram_story_insights(account_id, story_id, opts = {}) ⇒ GetInstagramStoryInsights200Response
Get Instagram story insights Returns metrics for a single story.
-
#get_instagram_story_insights_with_http_info(account_id, story_id, opts = {}) ⇒ Array<(GetInstagramStoryInsights200Response, Integer, Hash)>
Get Instagram story insights Returns metrics for a single story.
-
#initialize(api_client = ApiClient.default) ⇒ InstagramApi
constructor
A new instance of InstagramApi.
-
#list_instagram_stories(account_id, opts = {}) ⇒ ListInstagramStories200Response
List active Instagram stories Returns the IG Business/Creator account's currently-active stories.
-
#list_instagram_stories_with_http_info(account_id, opts = {}) ⇒ Array<(ListInstagramStories200Response, Integer, Hash)>
List active Instagram stories Returns the IG Business/Creator account's currently-active stories.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ InstagramApi
Returns a new instance of InstagramApi.
19 20 21 |
# File 'lib/zernio-sdk/api/instagram_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/zernio-sdk/api/instagram_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#get_instagram_publishing_limit(account_id, opts = {}) ⇒ GetInstagramPublishingLimit200Response
Get Instagram publishing limit
Returns the account's remaining content-publishing quota for Instagram's rolling 24-hour window, so you can pace publishing and warn before the cap is reached. quotaUsage counts containers published since the start of the window. Always compare against the returned quotaTotal rather than hardcoding a number: Meta's prose documentation and the live API disagree on the value, and the live value is authoritative.
27 28 29 30 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 27 def get_instagram_publishing_limit(account_id, opts = {}) data, _status_code, _headers = get_instagram_publishing_limit_with_http_info(account_id, opts) data end |
#get_instagram_publishing_limit_with_http_info(account_id, opts = {}) ⇒ Array<(GetInstagramPublishingLimit200Response, Integer, Hash)>
Get Instagram publishing limit Returns the account's remaining content-publishing quota for Instagram's rolling 24-hour window, so you can pace publishing and warn before the cap is reached. `quotaUsage` counts containers published since the start of the window. Always compare against the returned `quotaTotal` rather than hardcoding a number: Meta's prose documentation and the live API disagree on the value, and the live value is authoritative.
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 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 37 def get_instagram_publishing_limit_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InstagramApi.get_instagram_publishing_limit ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling InstagramApi.get_instagram_publishing_limit" end # resource path local_var_path = '/v1/accounts/{accountId}/instagram/publishing-limit'.sub('{' + 'accountId' + '}', CGI.escape(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] || 'GetInstagramPublishingLimit200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"InstagramApi.get_instagram_publishing_limit", :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: InstagramApi#get_instagram_publishing_limit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_instagram_story_insights(account_id, story_id, opts = {}) ⇒ GetInstagramStoryInsights200Response
Get Instagram story insights
Returns metrics for a single story. The source field discriminates between three states: - live — fetched from Meta in real time (story is still active) - cached — fetched from a persisted story_insights webhook payload (story has expired but we received its final-state metrics from Meta) - unavailable — story has expired and we never received its webhook payload (for example, the account connected after the story expired) Field semantics follow Meta's API. Counts below 5 may be returned as 0 due to Meta's privacy floor on small audiences. The navigation field is the sum of tapsForward + tapsBack + exits + swipesForward.
91 92 93 94 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 91 def get_instagram_story_insights(account_id, story_id, opts = {}) data, _status_code, _headers = get_instagram_story_insights_with_http_info(account_id, story_id, opts) data end |
#get_instagram_story_insights_with_http_info(account_id, story_id, opts = {}) ⇒ Array<(GetInstagramStoryInsights200Response, Integer, Hash)>
Get Instagram story insights Returns metrics for a single story. The `source` field discriminates between three states: - `live` — fetched from Meta in real time (story is still active) - `cached` — fetched from a persisted `story_insights` webhook payload (story has expired but we received its final-state metrics from Meta) - `unavailable` — story has expired and we never received its webhook payload (for example, the account connected after the story expired) Field semantics follow Meta's API. Counts below 5 may be returned as 0 due to Meta's privacy floor on small audiences. The `navigation` field is the sum of `tapsForward + tapsBack + exits + swipesForward`.
102 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 152 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 102 def get_instagram_story_insights_with_http_info(account_id, story_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InstagramApi.get_instagram_story_insights ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling InstagramApi.get_instagram_story_insights" end # verify the required parameter 'story_id' is set if @api_client.config.client_side_validation && story_id.nil? fail ArgumentError, "Missing the required parameter 'story_id' when calling InstagramApi.get_instagram_story_insights" end # resource path local_var_path = '/v1/accounts/{accountId}/instagram/stories/{storyId}/insights'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'storyId' + '}', CGI.escape(story_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] || 'GetInstagramStoryInsights200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"InstagramApi.get_instagram_story_insights", :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: InstagramApi#get_instagram_story_insights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_instagram_stories(account_id, opts = {}) ⇒ ListInstagramStories200Response
List active Instagram stories
Returns the IG Business/Creator account's currently-active stories. Meta keeps stories live for 24h; expired stories are not returned. Limitations propagated from Meta (these are NOT bugs): - 24h window only - Live videos excluded - Reshared stories not returned - mediaUrl may be null if Meta flagged the story for copyright - caption, likeCount, commentsCount do not apply to story media
159 160 161 162 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 159 def list_instagram_stories(account_id, opts = {}) data, _status_code, _headers = list_instagram_stories_with_http_info(account_id, opts) data end |
#list_instagram_stories_with_http_info(account_id, opts = {}) ⇒ Array<(ListInstagramStories200Response, Integer, Hash)>
List active Instagram stories Returns the IG Business/Creator account's currently-active stories. Meta keeps stories live for 24h; expired stories are not returned. Limitations propagated from Meta (these are NOT bugs): - 24h window only - Live videos excluded - Reshared stories not returned - `mediaUrl` may be null if Meta flagged the story for copyright - `caption`, `likeCount`, `commentsCount` do not apply to story media
169 170 171 172 173 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 |
# File 'lib/zernio-sdk/api/instagram_api.rb', line 169 def list_instagram_stories_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InstagramApi.list_instagram_stories ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling InstagramApi.list_instagram_stories" end # resource path local_var_path = '/v1/accounts/{accountId}/instagram/stories'.sub('{' + 'accountId' + '}', CGI.escape(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] || 'ListInstagramStories200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"InstagramApi.list_instagram_stories", :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: InstagramApi#list_instagram_stories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |