Class: Zernio::BlogsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/blogs_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BlogsApi

Returns a new instance of BlogsApi.



19
20
21
# File 'lib/zernio-sdk/api/blogs_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/zernio-sdk/api/blogs_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_blog(account_id, create_blog_request, opts = {}) ⇒ CreateBlog201Response

Create a blog Creates a blog on the connected store. The platform generates the URL handle from the title when omitted. Supported on Shopify (platform shopify). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

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

    the optional parameters

Returns:



28
29
30
31
# File 'lib/zernio-sdk/api/blogs_api.rb', line 28

def create_blog(, create_blog_request, opts = {})
  data, _status_code, _headers = create_blog_with_http_info(, create_blog_request, opts)
  data
end

#create_blog_article(account_id, blog_id, create_blog_article_request, opts = {}) ⇒ CreateBlogArticle201Response

Create a blog article Creates an article on the blog. Publishing behavior: - isPublished: false keeps the article as a draft. - A future publishDate schedules publication natively on the platform; the platform publishes it at that time with no Zernio queue involved. - seo.title / seo.description map to Shopify's global title_tag and description_tag metafields (the fields Shopify themes read for the page title and meta description). Supported on Shopify (platform shopify). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

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

    the optional parameters

Returns:



103
104
105
106
# File 'lib/zernio-sdk/api/blogs_api.rb', line 103

def create_blog_article(, blog_id, create_blog_article_request, opts = {})
  data, _status_code, _headers = create_blog_article_with_http_info(, blog_id, create_blog_article_request, opts)
  data
end

#create_blog_article_with_http_info(account_id, blog_id, create_blog_article_request, opts = {}) ⇒ Array<(CreateBlogArticle201Response, Integer, Hash)>

Create a blog article Creates an article on the blog. Publishing behavior: - `isPublished: false` keeps the article as a draft. - A future `publishDate` schedules publication natively on the platform; the platform publishes it at that time with no Zernio queue involved. - `seo.title` / `seo.description` map to Shopify's global `title_tag` and `description_tag` metafields (the fields Shopify themes read for the page title and meta description). Supported on Shopify (platform `shopify`). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

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

    the optional parameters

Returns:



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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/zernio-sdk/api/blogs_api.rb', line 115

def create_blog_article_with_http_info(, blog_id, create_blog_article_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BlogsApi.create_blog_article ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling BlogsApi.create_blog_article"
  end
  # verify the required parameter 'blog_id' is set
  if @api_client.config.client_side_validation && blog_id.nil?
    fail ArgumentError, "Missing the required parameter 'blog_id' when calling BlogsApi.create_blog_article"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && blog_id !~ pattern
    fail ArgumentError, "invalid value for 'blog_id' when calling BlogsApi.create_blog_article, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'create_blog_article_request' is set
  if @api_client.config.client_side_validation && create_blog_article_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_blog_article_request' when calling BlogsApi.create_blog_article"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/blogs/{blogId}/articles'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'blogId' + '}', CGI.escape(blog_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']
  # 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_blog_article_request)

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

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

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

#create_blog_with_http_info(account_id, create_blog_request, opts = {}) ⇒ Array<(CreateBlog201Response, Integer, Hash)>

Create a blog Creates a blog on the connected store. The platform generates the URL `handle` from the title when omitted. Supported on Shopify (platform `shopify`). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

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

    the optional parameters

Returns:

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

    CreateBlog201Response data, response status code and response headers



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
# File 'lib/zernio-sdk/api/blogs_api.rb', line 39

def create_blog_with_http_info(, create_blog_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BlogsApi.create_blog ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling BlogsApi.create_blog"
  end
  # verify the required parameter 'create_blog_request' is set
  if @api_client.config.client_side_validation && create_blog_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_blog_request' when calling BlogsApi.create_blog"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/blogs'.sub('{' + 'accountId' + '}', CGI.escape(.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']
  # 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_blog_request)

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

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

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

#delete_blog(account_id, blog_id, opts = {}) ⇒ nil

Delete a blog Deletes the blog AND every article in it. The delete happens on the platform and is permanent; Zernio stores nothing to restore it from. Supported on Shopify (platform shopify). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

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

    the optional parameters

Returns:

  • (nil)


187
188
189
190
# File 'lib/zernio-sdk/api/blogs_api.rb', line 187

def delete_blog(, blog_id, opts = {})
  delete_blog_with_http_info(, blog_id, opts)
  nil
end

#delete_blog_article(account_id, blog_id, article_id, opts = {}) ⇒ nil

Delete a blog article Deletes the article. The delete happens on the platform and is permanent; Zernio stores nothing to restore it from. Supported on Shopify (platform shopify). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

  • article_id (String)

    Platform-native numeric article id. Non-numeric values return 400.

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

    the optional parameters

Returns:

  • (nil)


262
263
264
265
# File 'lib/zernio-sdk/api/blogs_api.rb', line 262

def delete_blog_article(, blog_id, article_id, opts = {})
  delete_blog_article_with_http_info(, blog_id, article_id, opts)
  nil
end

#delete_blog_article_with_http_info(account_id, blog_id, article_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a blog article Deletes the article. The delete happens on the platform and is permanent; Zernio stores nothing to restore it from. Supported on Shopify (platform `shopify`). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

  • article_id (String)

    Platform-native numeric article id. Non-numeric values return 400.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/zernio-sdk/api/blogs_api.rb', line 274

def delete_blog_article_with_http_info(, blog_id, article_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BlogsApi.delete_blog_article ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling BlogsApi.delete_blog_article"
  end
  # verify the required parameter 'blog_id' is set
  if @api_client.config.client_side_validation && blog_id.nil?
    fail ArgumentError, "Missing the required parameter 'blog_id' when calling BlogsApi.delete_blog_article"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && blog_id !~ pattern
    fail ArgumentError, "invalid value for 'blog_id' when calling BlogsApi.delete_blog_article, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'article_id' is set
  if @api_client.config.client_side_validation && article_id.nil?
    fail ArgumentError, "Missing the required parameter 'article_id' when calling BlogsApi.delete_blog_article"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && article_id !~ pattern
    fail ArgumentError, "invalid value for 'article_id' when calling BlogsApi.delete_blog_article, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/accounts/{accountId}/blogs/{blogId}/articles/{articleId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'blogId' + '}', CGI.escape(blog_id.to_s)).sub('{' + 'articleId' + '}', CGI.escape(article_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]

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

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

#delete_blog_with_http_info(account_id, blog_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a blog Deletes the blog AND every article in it. The delete happens on the platform and is permanent; Zernio stores nothing to restore it from. Supported on Shopify (platform `shopify`). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/zernio-sdk/api/blogs_api.rb', line 198

def delete_blog_with_http_info(, blog_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BlogsApi.delete_blog ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling BlogsApi.delete_blog"
  end
  # verify the required parameter 'blog_id' is set
  if @api_client.config.client_side_validation && blog_id.nil?
    fail ArgumentError, "Missing the required parameter 'blog_id' when calling BlogsApi.delete_blog"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && blog_id !~ pattern
    fail ArgumentError, "invalid value for 'blog_id' when calling BlogsApi.delete_blog, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/accounts/{accountId}/blogs/{blogId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'blogId' + '}', CGI.escape(blog_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]

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

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

#get_blog(account_id, blog_id, opts = {}) ⇒ CreateBlog201Response

Get a blog Fetches a single blog. blogId is the platform's numeric blog id from GET /v1/accounts/{accountId}/blogs, not a Zernio id. Supported on Shopify (platform shopify). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

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

    the optional parameters

Returns:



346
347
348
349
# File 'lib/zernio-sdk/api/blogs_api.rb', line 346

def get_blog(, blog_id, opts = {})
  data, _status_code, _headers = get_blog_with_http_info(, blog_id, opts)
  data
end

#get_blog_article(account_id, blog_id, article_id, opts = {}) ⇒ CreateBlogArticle201Response

Get a blog article Fetches a single article. An article addressed through a blog it does not belong to is a 404 (code blog_article_not_found). Supported on Shopify (platform shopify). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

  • article_id (String)

    Platform-native numeric article id. Non-numeric values return 400.

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

    the optional parameters

Returns:



421
422
423
424
# File 'lib/zernio-sdk/api/blogs_api.rb', line 421

def get_blog_article(, blog_id, article_id, opts = {})
  data, _status_code, _headers = get_blog_article_with_http_info(, blog_id, article_id, opts)
  data
end

#get_blog_article_with_http_info(account_id, blog_id, article_id, opts = {}) ⇒ Array<(CreateBlogArticle201Response, Integer, Hash)>

Get a blog article Fetches a single article. An article addressed through a blog it does not belong to is a 404 (code blog_article_not_found). Supported on Shopify (platform `shopify`). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

  • article_id (String)

    Platform-native numeric article id. Non-numeric values return 400.

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

    the optional parameters

Returns:



433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
# File 'lib/zernio-sdk/api/blogs_api.rb', line 433

def get_blog_article_with_http_info(, blog_id, article_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BlogsApi.get_blog_article ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling BlogsApi.get_blog_article"
  end
  # verify the required parameter 'blog_id' is set
  if @api_client.config.client_side_validation && blog_id.nil?
    fail ArgumentError, "Missing the required parameter 'blog_id' when calling BlogsApi.get_blog_article"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && blog_id !~ pattern
    fail ArgumentError, "invalid value for 'blog_id' when calling BlogsApi.get_blog_article, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'article_id' is set
  if @api_client.config.client_side_validation && article_id.nil?
    fail ArgumentError, "Missing the required parameter 'article_id' when calling BlogsApi.get_blog_article"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && article_id !~ pattern
    fail ArgumentError, "invalid value for 'article_id' when calling BlogsApi.get_blog_article, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/accounts/{accountId}/blogs/{blogId}/articles/{articleId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'blogId' + '}', CGI.escape(blog_id.to_s)).sub('{' + 'articleId' + '}', CGI.escape(article_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] || 'CreateBlogArticle201Response'

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

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

#get_blog_with_http_info(account_id, blog_id, opts = {}) ⇒ Array<(CreateBlog201Response, Integer, Hash)>

Get a blog Fetches a single blog. `blogId` is the platform's numeric blog id from `GET /v1/accounts/accountId/blogs`, not a Zernio id. Supported on Shopify (platform `shopify`). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

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

    the optional parameters

Returns:

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

    CreateBlog201Response data, response status code and response headers



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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# File 'lib/zernio-sdk/api/blogs_api.rb', line 357

def get_blog_with_http_info(, blog_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BlogsApi.get_blog ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling BlogsApi.get_blog"
  end
  # verify the required parameter 'blog_id' is set
  if @api_client.config.client_side_validation && blog_id.nil?
    fail ArgumentError, "Missing the required parameter 'blog_id' when calling BlogsApi.get_blog"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && blog_id !~ pattern
    fail ArgumentError, "invalid value for 'blog_id' when calling BlogsApi.get_blog, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/accounts/{accountId}/blogs/{blogId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'blogId' + '}', CGI.escape(blog_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] || 'CreateBlog201Response'

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

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

#list_blog_articles(account_id, blog_id, opts = {}) ⇒ ListBlogArticles200Response

List blog articles Lists the articles of a blog. Cursor-paginated: pass limit (1-50, default 20) and the cursor from a previous response's nextCursor; nextCursor is null when there are no more pages. Supported on Shopify (platform shopify). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Page size (1-50). (default to 20)

  • :cursor (String)

    Opaque cursor from a previous response. Omit for the first page.

Returns:



507
508
509
510
# File 'lib/zernio-sdk/api/blogs_api.rb', line 507

def list_blog_articles(, blog_id, opts = {})
  data, _status_code, _headers = list_blog_articles_with_http_info(, blog_id, opts)
  data
end

#list_blog_articles_with_http_info(account_id, blog_id, opts = {}) ⇒ Array<(ListBlogArticles200Response, Integer, Hash)>

List blog articles Lists the articles of a blog. Cursor-paginated: pass `limit` (1-50, default 20) and the `cursor` from a previous response's `nextCursor`; `nextCursor` is null when there are no more pages. Supported on Shopify (platform `shopify`). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Page size (1-50). (default to 20)

  • :cursor (String)

    Opaque cursor from a previous response. Omit for the first page.

Returns:

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

    ListBlogArticles200Response data, response status code and response headers



520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
# File 'lib/zernio-sdk/api/blogs_api.rb', line 520

def list_blog_articles_with_http_info(, blog_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BlogsApi.list_blog_articles ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling BlogsApi.list_blog_articles"
  end
  # verify the required parameter 'blog_id' is set
  if @api_client.config.client_side_validation && blog_id.nil?
    fail ArgumentError, "Missing the required parameter 'blog_id' when calling BlogsApi.list_blog_articles"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && blog_id !~ pattern
    fail ArgumentError, "invalid value for 'blog_id' when calling BlogsApi.list_blog_articles, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling BlogsApi.list_blog_articles, must be smaller than or equal to 50.'
  end

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

  # resource path
  local_var_path = '/v1/accounts/{accountId}/blogs/{blogId}/articles'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'blogId' + '}', CGI.escape(blog_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].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] || 'ListBlogArticles200Response'

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

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

#list_blogs(account_id, opts = {}) ⇒ ListBlogs200Response

List blogs Lists the blogs on the connected store, newest-first as the platform returns them. Cursor-paginated: pass limit (1-50, default 20) and the cursor from a previous response's nextCursor; nextCursor is null when there are no more pages. Supported on Shopify (platform shopify). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Page size (1-50). (default to 20)

  • :cursor (String)

    Opaque cursor from a previous response. Omit for the first page.

Returns:



594
595
596
597
# File 'lib/zernio-sdk/api/blogs_api.rb', line 594

def list_blogs(, opts = {})
  data, _status_code, _headers = list_blogs_with_http_info(, opts)
  data
end

#list_blogs_with_http_info(account_id, opts = {}) ⇒ Array<(ListBlogs200Response, Integer, Hash)>

List blogs Lists the blogs on the connected store, newest-first as the platform returns them. Cursor-paginated: pass `limit` (1-50, default 20) and the `cursor` from a previous response's `nextCursor`; `nextCursor` is null when there are no more pages. Supported on Shopify (platform `shopify`). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Page size (1-50). (default to 20)

  • :cursor (String)

    Opaque cursor from a previous response. Omit for the first page.

Returns:

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

    ListBlogs200Response data, response status code and response headers



606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
# File 'lib/zernio-sdk/api/blogs_api.rb', line 606

def list_blogs_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BlogsApi.list_blogs ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling BlogsApi.list_blogs"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling BlogsApi.list_blogs, must be smaller than or equal to 50.'
  end

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

  # resource path
  local_var_path = '/v1/accounts/{accountId}/blogs'.sub('{' + 'accountId' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].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] || 'ListBlogs200Response'

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

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

#update_blog(account_id, blog_id, update_blog_request, opts = {}) ⇒ CreateBlog201Response

Update a blog Partial-updates a blog. Send any subset of title and handle; at least one field is required (an empty body returns 400). Supported on Shopify (platform shopify). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

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

    the optional parameters

Returns:



671
672
673
674
# File 'lib/zernio-sdk/api/blogs_api.rb', line 671

def update_blog(, blog_id, update_blog_request, opts = {})
  data, _status_code, _headers = update_blog_with_http_info(, blog_id, update_blog_request, opts)
  data
end

#update_blog_article(account_id, blog_id, article_id, update_blog_article_request, opts = {}) ⇒ CreateBlogArticle201Response

Update a blog article Partial-updates an article. Send any subset of the create fields (title, bodyHtml, handle, tags, author, excerpt, image, seo, isPublished, publishDate); at least one field is required (an empty body returns 400). isPublished and publishDate behave as on create: isPublished: false unpublishes back to a draft and a future publishDate schedules publication natively on the platform. Supported on Shopify (platform shopify). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

  • article_id (String)

    Platform-native numeric article id. Non-numeric values return 400.

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

    the optional parameters

Returns:



757
758
759
760
# File 'lib/zernio-sdk/api/blogs_api.rb', line 757

def update_blog_article(, blog_id, article_id, update_blog_article_request, opts = {})
  data, _status_code, _headers = update_blog_article_with_http_info(, blog_id, article_id, update_blog_article_request, opts)
  data
end

#update_blog_article_with_http_info(account_id, blog_id, article_id, update_blog_article_request, opts = {}) ⇒ Array<(CreateBlogArticle201Response, Integer, Hash)>

Update a blog article Partial-updates an article. Send any subset of the create fields (`title`, `bodyHtml`, `handle`, `tags`, `author`, `excerpt`, `image`, `seo`, `isPublished`, `publishDate`); at least one field is required (an empty body returns 400). `isPublished` and `publishDate` behave as on create: `isPublished: false` unpublishes back to a draft and a future `publishDate` schedules publication natively on the platform. Supported on Shopify (platform `shopify`). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

  • article_id (String)

    Platform-native numeric article id. Non-numeric values return 400.

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

    the optional parameters

Returns:



770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
# File 'lib/zernio-sdk/api/blogs_api.rb', line 770

def update_blog_article_with_http_info(, blog_id, article_id, update_blog_article_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BlogsApi.update_blog_article ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling BlogsApi.update_blog_article"
  end
  # verify the required parameter 'blog_id' is set
  if @api_client.config.client_side_validation && blog_id.nil?
    fail ArgumentError, "Missing the required parameter 'blog_id' when calling BlogsApi.update_blog_article"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && blog_id !~ pattern
    fail ArgumentError, "invalid value for 'blog_id' when calling BlogsApi.update_blog_article, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'article_id' is set
  if @api_client.config.client_side_validation && article_id.nil?
    fail ArgumentError, "Missing the required parameter 'article_id' when calling BlogsApi.update_blog_article"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && article_id !~ pattern
    fail ArgumentError, "invalid value for 'article_id' when calling BlogsApi.update_blog_article, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'update_blog_article_request' is set
  if @api_client.config.client_side_validation && update_blog_article_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_blog_article_request' when calling BlogsApi.update_blog_article"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/blogs/{blogId}/articles/{articleId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'blogId' + '}', CGI.escape(blog_id.to_s)).sub('{' + 'articleId' + '}', CGI.escape(article_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']
  # 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(update_blog_article_request)

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

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

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

#update_blog_with_http_info(account_id, blog_id, update_blog_request, opts = {}) ⇒ Array<(CreateBlog201Response, Integer, Hash)>

Update a blog Partial-updates a blog. Send any subset of `title` and `handle`; at least one field is required (an empty body returns 400). Supported on Shopify (platform `shopify`). Accounts on platforms without blogs support return 400; a blogs-capable platform that lacks this specific operation returns 405.

Parameters:

  • account_id (String)

    Connected Shopify SocialAccount id.

  • blog_id (String)

    Platform-native numeric blog id. Non-numeric values return 400.

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

    the optional parameters

Returns:

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

    CreateBlog201Response data, response status code and response headers



683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
# File 'lib/zernio-sdk/api/blogs_api.rb', line 683

def update_blog_with_http_info(, blog_id, update_blog_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BlogsApi.update_blog ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling BlogsApi.update_blog"
  end
  # verify the required parameter 'blog_id' is set
  if @api_client.config.client_side_validation && blog_id.nil?
    fail ArgumentError, "Missing the required parameter 'blog_id' when calling BlogsApi.update_blog"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && blog_id !~ pattern
    fail ArgumentError, "invalid value for 'blog_id' when calling BlogsApi.update_blog, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'update_blog_request' is set
  if @api_client.config.client_side_validation && update_blog_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_blog_request' when calling BlogsApi.update_blog"
  end
  # resource path
  local_var_path = '/v1/accounts/{accountId}/blogs/{blogId}'.sub('{' + 'accountId' + '}', CGI.escape(.to_s)).sub('{' + 'blogId' + '}', CGI.escape(blog_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']
  # 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(update_blog_request)

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

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

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