Class: ConstantContactClient::SocialApi

Inherits:
Object
  • Object
show all
Defined in:
lib/constant_contact_client/api/social_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SocialApi

Returns a new instance of SocialApi.



19
20
21
# File 'lib/constant_contact_client/api/social_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/constant_contact_client/api/social_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_social_post(create_social_post_request, opts = {}) ⇒ CreateSocialPost200Response

POST (create) a social media post Creates a new social media post that can be published immediately or scheduled for later publication. A post can target one or more social profiles, and can include text, images, and network-specific settings. Set status to DRAFT to save without publishing, or SCHEDULED to schedule for publication. Scheduled posts require a scheduled_time in ISO-8601 format. Post content and settings can vary per profile — each profile_posts entry can have its own text, images, and network-specific settings (e.g., TikTok-specific settings like disable_comment).

Parameters:

  • create_social_post_request (CreateSocialPostRequest)

    The social post content and configuration.

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/constant_contact_client/api/social_api.rb', line 27

def create_social_post(create_social_post_request, opts = {})
  data, _status_code, _headers = create_social_post_with_http_info(create_social_post_request, opts)
  data
end

#create_social_post_with_http_info(create_social_post_request, opts = {}) ⇒ Array<(CreateSocialPost200Response, Integer, Hash)>

POST (create) a social media post Creates a new social media post that can be published immediately or scheduled for later publication. A post can target one or more social profiles, and can include text, images, and network-specific settings. Set `status` to `DRAFT` to save without publishing, or `SCHEDULED` to schedule for publication. Scheduled posts require a `scheduled_time` in ISO-8601 format. Post content and settings can vary per profile — each `profile_posts` entry can have its own text, images, and network-specific settings (e.g., TikTok-specific settings like `disable_comment`).

Parameters:

  • create_social_post_request (CreateSocialPostRequest)

    The social post content and configuration.

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

    the optional parameters

Returns:

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

    CreateSocialPost200Response 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
85
86
87
88
# File 'lib/constant_contact_client/api/social_api.rb', line 37

def create_social_post_with_http_info(create_social_post_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SocialApi.create_social_post ...'
  end
  # verify the required parameter 'create_social_post_request' is set
  if @api_client.config.client_side_validation && create_social_post_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_social_post_request' when calling SocialApi.create_social_post"
  end
  # resource path
  local_var_path = '/social/posts'

  # 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'])
  # 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(create_social_post_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateSocialPost200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

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

#get_hashtag_groups(opts = {}) ⇒ GetHashtagGroups200Response

GET hashtag groups Retrieves a paginated list of saved hashtag groups for the account. Hashtag groups allow users to save and organize reusable collections of hashtags that can be applied to social posts. Use the limit and page query parameters to paginate through results. Navigate to the next page using the _links.next link in the response.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Maximum number of hashtag groups to retrieve per page. Default and maximum is `5`. (default to 5)

  • :page (Integer)

    Page number to retrieve (0-based). (default to 0)

Returns:



96
97
98
99
# File 'lib/constant_contact_client/api/social_api.rb', line 96

def get_hashtag_groups(opts = {})
  data, _status_code, _headers = get_hashtag_groups_with_http_info(opts)
  data
end

#get_hashtag_groups_with_http_info(opts = {}) ⇒ Array<(GetHashtagGroups200Response, Integer, Hash)>

GET hashtag groups Retrieves a paginated list of saved hashtag groups for the account. Hashtag groups allow users to save and organize reusable collections of hashtags that can be applied to social posts. Use the `limit` and `page` query parameters to paginate through results. Navigate to the next page using the `_links.next` link in the response.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Maximum number of hashtag groups to retrieve per page. Default and maximum is `5`. (default to 5)

  • :page (Integer)

    Page number to retrieve (0-based). (default to 0)

Returns:

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

    GetHashtagGroups200Response data, response status code and response headers



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
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/constant_contact_client/api/social_api.rb', line 107

def get_hashtag_groups_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SocialApi.get_hashtag_groups ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 5
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling SocialApi.get_hashtag_groups, must be smaller than or equal to 5.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling SocialApi.get_hashtag_groups, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 0
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling SocialApi.get_hashtag_groups, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = '/social/hashtags/groups'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # 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] || 'GetHashtagGroups200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"SocialApi.get_hashtag_groups",
    :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: SocialApi#get_hashtag_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_social_connections(opts = {}) ⇒ GetSocialConnections200Response

GET social network connections Retrieves all social network accounts connected to the Constant Contact account, with support for multiple accounts per social network. A connection represents the authorization link between a Constant Contact account and a single account on a social network (Facebook, Instagram, LinkedIn, TikTok, etc.). Each connection includes account information about the connected user on that network (display name, username, image, etc.) and the current status of the connection (whether it's active, rate-limited, or has any errors). Note that a single connection may have multiple profiles (pages) associated with it — use GET /social/profiles to retrieve the individual profiles.

Parameters:

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

    the optional parameters

Returns:



169
170
171
172
# File 'lib/constant_contact_client/api/social_api.rb', line 169

def get_social_connections(opts = {})
  data, _status_code, _headers = get_social_connections_with_http_info(opts)
  data
end

#get_social_connections_with_http_info(opts = {}) ⇒ Array<(GetSocialConnections200Response, Integer, Hash)>

GET social network connections Retrieves all social network accounts connected to the Constant Contact account, with support for multiple accounts per social network. A connection represents the authorization link between a Constant Contact account and a single account on a social network (Facebook, Instagram, LinkedIn, TikTok, etc.). Each connection includes account information about the connected user on that network (display name, username, image, etc.) and the current status of the connection (whether it's active, rate-limited, or has any errors). Note that a single connection may have multiple profiles (pages) associated with it — use `GET /social/profiles` to retrieve the individual profiles.

Parameters:

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

    the optional parameters

Returns:



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
# File 'lib/constant_contact_client/api/social_api.rb', line 178

def get_social_connections_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SocialApi.get_social_connections ...'
  end
  # resource path
  local_var_path = '/social/connections'

  # 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'])

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetSocialConnections200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

  new_options = opts.merge(
    :operation => :"SocialApi.get_social_connections",
    :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: SocialApi#get_social_connections\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_social_profiles(opts = {}) ⇒ Array<GetSocialProfiles200ResponseInner>

GET social media profiles Retrieves all social media profiles connected to the account. A profile represents a single account on a social network (such as a Facebook Business Page, a LinkedIn Company Page, or an Instagram Business account) that the user has connected to Constant Contact. Use the include=accessible query parameter to additionally check whether each profile is currently accessible for posting. Profiles that are not currently accessible will fail if used to publish a post.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :include (Array<String>)

    Optional sub-resources to include. Use `accessible` to check if profiles are accessible on the network.

Returns:



227
228
229
230
# File 'lib/constant_contact_client/api/social_api.rb', line 227

def get_social_profiles(opts = {})
  data, _status_code, _headers = get_social_profiles_with_http_info(opts)
  data
end

#get_social_profiles_with_http_info(opts = {}) ⇒ Array<(Array<GetSocialProfiles200ResponseInner>, Integer, Hash)>

GET social media profiles Retrieves all social media profiles connected to the account. A profile represents a single account on a social network (such as a Facebook Business Page, a LinkedIn Company Page, or an Instagram Business account) that the user has connected to Constant Contact. Use the `include=accessible` query parameter to additionally check whether each profile is currently accessible for posting. Profiles that are not currently accessible will fail if used to publish a post.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :include (Array<String>)

    Optional sub-resources to include. Use `accessible` to check if profiles are accessible on the network.

Returns:



237
238
239
240
241
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/constant_contact_client/api/social_api.rb', line 237

def get_social_profiles_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SocialApi.get_social_profiles ...'
  end
  allowable_values = []
  if @api_client.config.client_side_validation && opts[:'include'] && !opts[:'include'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"include\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/social/profiles'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # 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] || 'Array<GetSocialProfiles200ResponseInner>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2_access_code', 'oauth2_implicit']

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