cxf 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/client.rb +17 -8
- data/lib/contact.rb +1 -1
- data/lib/cxf/controllers/concerns/cxf_clients.rb +4 -4
- data/lib/cxf/helpers/contact_auth_helper.rb +1 -1
- data/lib/pub/content/assets.rb +2 -2
- data/lib/pub/content/content.rb +13 -9
- data/lib/pub/content/content_prints.rb +95 -0
- data/lib/pub/content/print_versions.rb +98 -0
- data/lib/pub.rb +1 -0
- data/lib/user/content/content.rb +6 -6
- data/lib/user/ecommerce/ecommerce.rb +0 -2
- metadata +5 -6
- data/lib/user/content/stories.rb +0 -110
- data/lib/user/content/story_templates.rb +0 -97
- data/lib/user/ecommerce/locations.rb +0 -171
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22426960737d0c65a4ca1603559ef4aeee6a510a7c06a8f2e0c072d411b1859c
|
4
|
+
data.tar.gz: 64ae056bc07ceaeac86c3891cede013561d1925ed9e7a394953807209fff0fe9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96b03b5dde503caf427298ffc193f3b6f1cd1da77f6c654949531f8d9a757101cd46c994fb6b88de331821e50f4c10742afed4751caba4159cdece130446333f
|
7
|
+
data.tar.gz: 0af7c700c417c05402f2b9ccdea8727b7f75cd4eb34742c36b1eb22db28ede33038bbaa6d85a555b0e3e5bac519c29b59edba94eb872dda38154673b04f7312c
|
data/lib/client.rb
CHANGED
@@ -149,8 +149,7 @@ module Cxf
|
|
149
149
|
replace_tokens(response)
|
150
150
|
end
|
151
151
|
|
152
|
-
verify_response_status(response, config['sdk']['ignore_http_errors'])
|
153
|
-
|
152
|
+
response = verify_response_status(response, config['sdk']['ignore_http_errors'])
|
154
153
|
begin
|
155
154
|
if @debug
|
156
155
|
response_from = if result_from_cache
|
@@ -381,16 +380,26 @@ module Cxf
|
|
381
380
|
|
382
381
|
if !is_success and !ignore_http_errors
|
383
382
|
title = "Request failed with status #{http_status}"
|
384
|
-
detail = response&.response&.message || 'Unknown error'
|
383
|
+
detail = response&.parsed_response["message"] ||response&.response&.message || 'Unknown error'
|
385
384
|
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
385
|
+
if @debug
|
386
|
+
puts "Error detected: #{http_status}"
|
387
|
+
error_class = Errors::DynamicError.new(self, title, detail, http_status, response&.parsed_response)
|
388
|
+
raise error_class
|
389
|
+
end
|
390
390
|
|
391
|
-
|
391
|
+
response = JSON.generate(
|
392
|
+
{
|
393
|
+
'error' => {
|
394
|
+
'title' => title,
|
395
|
+
'status' => http_status
|
396
|
+
},
|
397
|
+
'message' => detail
|
398
|
+
}
|
399
|
+
)
|
392
400
|
end
|
393
401
|
end
|
402
|
+
response
|
394
403
|
end
|
395
404
|
|
396
405
|
# Timeouts methods
|
data/lib/contact.rb
CHANGED
@@ -64,7 +64,7 @@ module CxfClients
|
|
64
64
|
# Initialize cxf contact client
|
65
65
|
contact_session_token = cookies[:cxf_contact_session_token]
|
66
66
|
contact_refresh_token = cookies[:cxf_contact_refresh_token]
|
67
|
-
contact_token_id = cookies[:cxf_contact_id]
|
67
|
+
contact_token_id = cookies[:cxf_contact_id] || nil
|
68
68
|
user_agent = request.user_agent
|
69
69
|
@cxf_contact = Cxf::Contact.new(
|
70
70
|
@host,
|
@@ -103,9 +103,9 @@ module CxfClients
|
|
103
103
|
user_agent = request.user_agent
|
104
104
|
@cxf_service_account = Cxf::User.new(
|
105
105
|
@host,
|
106
|
-
@api_key,
|
107
|
-
@api_key,
|
108
|
-
@api_key,
|
106
|
+
@api_key, # api token
|
107
|
+
@api_key, # session token
|
108
|
+
@api_key, # refresh token
|
109
109
|
@debug,
|
110
110
|
user_agent
|
111
111
|
)
|
@@ -11,8 +11,8 @@ module ContactAuthHelper
|
|
11
11
|
if response.key? 'data'
|
12
12
|
session_token = response['data']['session_token']
|
13
13
|
refresh_token = response['data']['refresh_token']
|
14
|
+
id_token = response['data']['contact_token'] || response['data']['id_token'] || nil
|
14
15
|
end
|
15
|
-
# id_token = response['contact']['contact_token'] ? response['contact']['contact_token'] : response['contact']['id_token']
|
16
16
|
# Set a permanent cookie with the session token
|
17
17
|
cookies.permanent[:cxf_contact_session_token] = { value: session_token, secure: true, httponly: true }
|
18
18
|
cookies.permanent[:cxf_contact_refresh_token] = { value: refresh_token, secure: true, httponly: true }
|
data/lib/pub/content/assets.rb
CHANGED
@@ -10,7 +10,7 @@ module PublicAssets
|
|
10
10
|
#
|
11
11
|
# ==== Example
|
12
12
|
# @data = @cxf_pub.get_asset_info("asset_slug")
|
13
|
-
def
|
14
|
-
@client.raw('get', "
|
13
|
+
def get_public_asset(slug)
|
14
|
+
@client.raw('get', "public-assets/#{slug}", nil, nil, '/')
|
15
15
|
end
|
16
16
|
end
|
data/lib/pub/content/content.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
### V1/CONTENT ###
|
4
|
-
|
5
|
-
require_relative './assets'
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
### V1/CONTENT ###
|
4
|
+
|
5
|
+
require_relative './assets'
|
6
|
+
require_relative './content_prints'
|
7
|
+
require_relative './print_versions'
|
8
|
+
|
9
|
+
module PublicContent
|
10
|
+
include PublicAssets
|
11
|
+
include ContentPrints
|
12
|
+
include PrintVersions
|
13
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module ContentPrints
|
3
|
+
# === Get content print.
|
4
|
+
# Get a collection of content print.
|
5
|
+
#
|
6
|
+
# ==== Parameters
|
7
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
8
|
+
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
9
|
+
#
|
10
|
+
# ==== First Example
|
11
|
+
# @data = @cxf_user.get_content_prints
|
12
|
+
#
|
13
|
+
# ==== Second Example
|
14
|
+
# options = {
|
15
|
+
# fields: 'id, slug'
|
16
|
+
# }
|
17
|
+
# @data = @cxf_user.get_content_prints(options)
|
18
|
+
#
|
19
|
+
# ==== Third Example
|
20
|
+
# options = {
|
21
|
+
# fields: 'id, slug'
|
22
|
+
# }
|
23
|
+
# @data = @cxf_user.get_content_prints(options, true)
|
24
|
+
def get_content_prints(options = nil, use_post = true)
|
25
|
+
get_query_results('/content/content-prints', options, use_post)
|
26
|
+
end
|
27
|
+
|
28
|
+
# === Get content print.
|
29
|
+
# Get a content print info.
|
30
|
+
#
|
31
|
+
# ==== Parameters
|
32
|
+
# id:: (Integer) -- content print id.
|
33
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
34
|
+
#
|
35
|
+
# ==== First Example
|
36
|
+
# @data = @cxf_user.get_content_print(1)
|
37
|
+
#
|
38
|
+
# ==== Second Example
|
39
|
+
# options = {
|
40
|
+
# fields: 'id, slug'
|
41
|
+
# }
|
42
|
+
# @data = @cxf_user.get_content_print(1, options)
|
43
|
+
def get_content_print(id, options = nil)
|
44
|
+
@client.raw('get', "/content/content-prints/#{id}", options, nil)
|
45
|
+
end
|
46
|
+
|
47
|
+
# === Create content print.
|
48
|
+
# Create a content print with data.
|
49
|
+
#
|
50
|
+
# ==== Parameters
|
51
|
+
# data:: (Hash) -- Data to be submitted.
|
52
|
+
#
|
53
|
+
# ==== Example
|
54
|
+
# data = {
|
55
|
+
# user_id: 1,
|
56
|
+
# slug: "new-content print",
|
57
|
+
# content print_template_id: 1
|
58
|
+
# }
|
59
|
+
#
|
60
|
+
# options = { fields: 'id,slug' }
|
61
|
+
#
|
62
|
+
# @data = @cxf_user.create_content_print(data, options)
|
63
|
+
def create_content_print(data, options = nil)
|
64
|
+
@client.raw('post', '/content/content-prints', options, data_transform(data))
|
65
|
+
end
|
66
|
+
|
67
|
+
# === Update content print.
|
68
|
+
# Update a content print info.
|
69
|
+
#
|
70
|
+
# ==== Parameters
|
71
|
+
# id:: (Integer) -- content print id.
|
72
|
+
# data:: (Hash) -- Data to be submitted.
|
73
|
+
#
|
74
|
+
# ==== Example
|
75
|
+
# data = {
|
76
|
+
# user_id: 1,
|
77
|
+
# slug: 'new-content print'
|
78
|
+
# }
|
79
|
+
# @data = @cxf_user.update_content_print(5, data)
|
80
|
+
def update_content_print(id, data, options = nil)
|
81
|
+
@client.raw('put', "/content/content-prints/#{id}", options, data_transform(data))
|
82
|
+
end
|
83
|
+
|
84
|
+
# === Delete content print.
|
85
|
+
# Delete a content print.
|
86
|
+
#
|
87
|
+
# ==== Parameters
|
88
|
+
# id:: (Integer) -- content print id.
|
89
|
+
#
|
90
|
+
# ==== Example
|
91
|
+
# @data = @cxf_user.delete_content_print(6)
|
92
|
+
def delete_content_print(id)
|
93
|
+
@client.raw('delete', "/content/content-prints/#{id}", nil, nil)
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PrintVersions
|
4
|
+
# === Get print versions.
|
5
|
+
# Get a collection of print versions.
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
9
|
+
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
10
|
+
#
|
11
|
+
# ==== First Example
|
12
|
+
# @data = @cxf_user.get_print_versions
|
13
|
+
#
|
14
|
+
# ==== Second Example
|
15
|
+
# options = {
|
16
|
+
# fields: 'id, title'
|
17
|
+
# }
|
18
|
+
# @data = @cxf_user.get_print_versions(options)
|
19
|
+
#
|
20
|
+
# ==== Third Example
|
21
|
+
# options = {
|
22
|
+
# fields: 'id, title'
|
23
|
+
# }
|
24
|
+
# @data = @cxf_user.get_print_versions(options, true)
|
25
|
+
def get_print_versions(options = nil, use_post = true)
|
26
|
+
get_query_results('/content/print-versions', options, use_post)
|
27
|
+
end
|
28
|
+
|
29
|
+
# === Get print version.
|
30
|
+
# Get a print version info.
|
31
|
+
#
|
32
|
+
# ==== Parameters
|
33
|
+
# id:: (Integer) -- print version id.
|
34
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
35
|
+
#
|
36
|
+
# ==== First Example
|
37
|
+
# @data = @cxf_user.get_print_version(1)
|
38
|
+
#
|
39
|
+
# ==== Second Example
|
40
|
+
# options = {
|
41
|
+
# fields: 'id, title'
|
42
|
+
# }
|
43
|
+
# @data = @cxf_user.get_print_version(1, options)
|
44
|
+
def get_print_version(id, options = nil)
|
45
|
+
@client.raw('get', "/content/print-versions/#{id}", options, nil)
|
46
|
+
end
|
47
|
+
|
48
|
+
# === Create print version.
|
49
|
+
# Create a print version with data.
|
50
|
+
#
|
51
|
+
# ==== Parameters
|
52
|
+
# data:: (Hash) -- Data to be submitted.
|
53
|
+
#
|
54
|
+
# ==== Example
|
55
|
+
# data = {
|
56
|
+
# title: 'New print',
|
57
|
+
# slug: 'new-print',
|
58
|
+
# social_metadata: 'social metadata'
|
59
|
+
# }
|
60
|
+
# @data = @cxf_user.create_print_version(data)
|
61
|
+
def create_print_version(data, options = nil)
|
62
|
+
@client.raw('post', '/content/print-versions', options, data_transform(data))
|
63
|
+
end
|
64
|
+
|
65
|
+
# === CHECK THIS ===
|
66
|
+
# def create_print_version_from_instance(id, data, options = nil)
|
67
|
+
# @client.raw('post', "/content/print-versions/#{id}/print-version", options, data_transform(data))
|
68
|
+
# end
|
69
|
+
|
70
|
+
# === Update print version.
|
71
|
+
# Update a print version info.
|
72
|
+
#
|
73
|
+
# ==== Parameters
|
74
|
+
# id:: (Integer) -- print version id.
|
75
|
+
# data:: (Hash) -- Data to be submitted.
|
76
|
+
#
|
77
|
+
# ==== Example
|
78
|
+
# data = {
|
79
|
+
# title: 'New print Modified',
|
80
|
+
# slug: 'new-print'
|
81
|
+
# }
|
82
|
+
# @data = @cxf_user.update_print_version(5, data)
|
83
|
+
def update_print_version(id, data, options = nil)
|
84
|
+
@client.raw('put', "/content/print-versions/#{id}", options, data_transform(data))
|
85
|
+
end
|
86
|
+
|
87
|
+
# === Delete print version.
|
88
|
+
# Delete a print version.
|
89
|
+
#
|
90
|
+
# ==== Parameters
|
91
|
+
# id:: (Integer) -- print version id.
|
92
|
+
#
|
93
|
+
# ==== Example
|
94
|
+
# @data = @cxf_user.delete_print_version(6)
|
95
|
+
def delete_print_version(id)
|
96
|
+
@client.raw('delete', "/content/print-versions/#{id}", nil, nil)
|
97
|
+
end
|
98
|
+
end
|
data/lib/pub.rb
CHANGED
data/lib/user/content/content.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require_relative './assets'
|
3
|
-
require_relative './stories'
|
4
|
-
require_relative './print_versions'
|
5
|
-
require_relative './story_templates'
|
6
3
|
require_relative './blocks'
|
7
4
|
require_relative './block_templates'
|
5
|
+
require_relative './content_bundles'
|
6
|
+
require_relative './content_prints'
|
8
7
|
require_relative './instances'
|
8
|
+
require_relative './print_versions'
|
9
9
|
require_relative './templates'
|
10
10
|
|
11
11
|
module Content
|
12
12
|
include Assets
|
13
|
-
include Stories
|
14
|
-
include PrintVersions
|
15
|
-
include StoryTemplates
|
16
13
|
include Blocks
|
17
14
|
include BlockTemplates
|
15
|
+
include ContentBundles
|
16
|
+
include ContentPrints
|
18
17
|
include Instances
|
18
|
+
include PrintVersions
|
19
19
|
include Templates
|
20
20
|
|
21
21
|
# === Get public images url.
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative './item_prices'
|
4
|
-
require_relative './locations'
|
5
4
|
require_relative './price_lists'
|
6
5
|
require_relative './product_templates'
|
7
6
|
require_relative './product_variations'
|
@@ -15,7 +14,6 @@ require_relative './vouchers'
|
|
15
14
|
|
16
15
|
module Ecommerce
|
17
16
|
include ItemPrices
|
18
|
-
include Locations
|
19
17
|
include PriceList
|
20
18
|
include ProductTemplates
|
21
19
|
include ProductVariations
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cxf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Ruben Gomez Garcia, Omar Mora, Luis Payan, Oscar Castillo, Fabian Garcia
|
7
|
+
- Ruben Gomez Garcia, Omar Mora, Luis Payan, Oscar Castillo, Fabian Garcia, Luis Hesiquio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -156,6 +156,8 @@ files:
|
|
156
156
|
- lib/pub/config/config.rb
|
157
157
|
- lib/pub/content/assets.rb
|
158
158
|
- lib/pub/content/content.rb
|
159
|
+
- lib/pub/content/content_prints.rb
|
160
|
+
- lib/pub/content/print_versions.rb
|
159
161
|
- lib/pub/ecommerce/ecommerce.rb
|
160
162
|
- lib/user.rb
|
161
163
|
- lib/user/config/attribute_groups.rb
|
@@ -178,15 +180,12 @@ files:
|
|
178
180
|
- lib/user/content/content_prints.rb
|
179
181
|
- lib/user/content/instances.rb
|
180
182
|
- lib/user/content/print_versions.rb
|
181
|
-
- lib/user/content/stories.rb
|
182
|
-
- lib/user/content/story_templates.rb
|
183
183
|
- lib/user/content/templates.rb
|
184
184
|
- lib/user/crm/companies.rb
|
185
185
|
- lib/user/crm/contacts.rb
|
186
186
|
- lib/user/crm/crm.rb
|
187
187
|
- lib/user/ecommerce/ecommerce.rb
|
188
188
|
- lib/user/ecommerce/item_prices.rb
|
189
|
-
- lib/user/ecommerce/locations.rb
|
190
189
|
- lib/user/ecommerce/price_lists.rb
|
191
190
|
- lib/user/ecommerce/product_templates.rb
|
192
191
|
- lib/user/ecommerce/product_variations.rb
|
data/lib/user/content/stories.rb
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Stories
|
4
|
-
# === Duplicate story.
|
5
|
-
# Duplicate a story.
|
6
|
-
#
|
7
|
-
# ==== Parameters
|
8
|
-
# id:: (Integer) -- Story id.
|
9
|
-
# data:: (Hash) -- Data to be submitted.
|
10
|
-
#
|
11
|
-
# ==== Example
|
12
|
-
# data = { options: [] }
|
13
|
-
# @data = @cxf_user.duplicate_story(1, data.to_json)
|
14
|
-
def duplicate_story(id, data)
|
15
|
-
@client.raw('post', "/content/stories/#{id}/duplicate", nil, data)
|
16
|
-
end
|
17
|
-
|
18
|
-
# === Get stories.
|
19
|
-
# Get a collection of stories.
|
20
|
-
#
|
21
|
-
# ==== Parameters
|
22
|
-
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
23
|
-
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
24
|
-
#
|
25
|
-
# ==== First Example
|
26
|
-
# @data = @cxf_user.get_stories
|
27
|
-
#
|
28
|
-
# ==== Second Example
|
29
|
-
# options = {
|
30
|
-
# fields: 'id, slug'
|
31
|
-
# }
|
32
|
-
# @data = @cxf_user.get_stories(options)
|
33
|
-
#
|
34
|
-
# ==== Third Example
|
35
|
-
# options = {
|
36
|
-
# fields: 'id, slug'
|
37
|
-
# }
|
38
|
-
# @data = @cxf_user.get_stories(options, true)
|
39
|
-
def get_stories(options = nil, use_post = true)
|
40
|
-
get_query_results('/content/stories', options, use_post)
|
41
|
-
end
|
42
|
-
|
43
|
-
# === Get story.
|
44
|
-
# Get a story info.
|
45
|
-
#
|
46
|
-
# ==== Parameters
|
47
|
-
# id:: (Integer) -- Story id.
|
48
|
-
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
49
|
-
#
|
50
|
-
# ==== First Example
|
51
|
-
# @data = @cxf_user.get_story(1)
|
52
|
-
#
|
53
|
-
# ==== Second Example
|
54
|
-
# options = {
|
55
|
-
# fields: 'id, slug'
|
56
|
-
# }
|
57
|
-
# @data = @cxf_user.get_story(1, options)
|
58
|
-
def get_story(id, options = nil)
|
59
|
-
@client.raw('get', "/content/stories/#{id}", options)
|
60
|
-
end
|
61
|
-
|
62
|
-
# === Create story.
|
63
|
-
# Create a story with data.
|
64
|
-
#
|
65
|
-
# ==== Parameters
|
66
|
-
# data:: (Hash) -- Data to be submitted.
|
67
|
-
#
|
68
|
-
# ==== Example
|
69
|
-
# data = {
|
70
|
-
# user_id: 1,
|
71
|
-
# slug: "new-story",
|
72
|
-
# story_template_id: 1
|
73
|
-
# }
|
74
|
-
#
|
75
|
-
# options = { fields: 'id,slug' }
|
76
|
-
#
|
77
|
-
# @data = @cxf_user.create_story(data, options)
|
78
|
-
def create_story(data, options = nil)
|
79
|
-
@client.raw('post', '/content/stories', options, data_transform(data))
|
80
|
-
end
|
81
|
-
|
82
|
-
# === Update story.
|
83
|
-
# Update a story info.
|
84
|
-
#
|
85
|
-
# ==== Parameters
|
86
|
-
# id:: (Integer) -- Story id.
|
87
|
-
# data:: (Hash) -- Data to be submitted.
|
88
|
-
#
|
89
|
-
# ==== Example
|
90
|
-
# data = {
|
91
|
-
# user_id: 1,
|
92
|
-
# slug: 'new-story'
|
93
|
-
# }
|
94
|
-
# @data = @cxf_user.update_story(5, data)
|
95
|
-
def update_story(id, data, options = nil)
|
96
|
-
@client.raw('put', "/content/stories/#{id}", options, data_transform(data))
|
97
|
-
end
|
98
|
-
|
99
|
-
# === Delete story.
|
100
|
-
# Delete a story.
|
101
|
-
#
|
102
|
-
# ==== Parameters
|
103
|
-
# id:: (Integer) -- Story id.
|
104
|
-
#
|
105
|
-
# ==== Example
|
106
|
-
# @data = @cxf_user.delete_story(6)
|
107
|
-
def delete_story(id)
|
108
|
-
@client.raw('delete', "/content/stories/#{id}")
|
109
|
-
end
|
110
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module StoryTemplates
|
4
|
-
##
|
5
|
-
# == Story Template
|
6
|
-
#
|
7
|
-
|
8
|
-
# === Get support data of story template.
|
9
|
-
# Get support data used in a story template.
|
10
|
-
#
|
11
|
-
# ==== Parameters
|
12
|
-
# id:: (Integer) -- Story template id.
|
13
|
-
#
|
14
|
-
# ==== Example
|
15
|
-
# @data = @cxf_user.get_story_template_support_data(1)
|
16
|
-
def get_story_template_support_data(id)
|
17
|
-
@client.raw('get', "/content/story-templates/support-data/stories/#{id}")
|
18
|
-
end
|
19
|
-
|
20
|
-
# === Get support data of story templates.
|
21
|
-
# Get support data used in story templates.
|
22
|
-
#
|
23
|
-
# ==== Example
|
24
|
-
# @data = @cxf_user.get_story_templates_support_data
|
25
|
-
def get_story_templates_support_data
|
26
|
-
@client.raw('get', '/content/story-templates/support-data')
|
27
|
-
end
|
28
|
-
|
29
|
-
# === Get story templates.
|
30
|
-
# Get a collection of story templates.
|
31
|
-
#
|
32
|
-
# ==== Parameters
|
33
|
-
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
34
|
-
#
|
35
|
-
# ==== First Example
|
36
|
-
# @data = @cxf_user.get_story_templates
|
37
|
-
#
|
38
|
-
# ==== Second Example
|
39
|
-
# options = {
|
40
|
-
# fields: 'id, title'
|
41
|
-
# }
|
42
|
-
# @data = @cxf_user.get_story_templates(options)
|
43
|
-
def get_story_templates(options = nil)
|
44
|
-
@client.raw('get', '/content/story-templates', options)
|
45
|
-
end
|
46
|
-
|
47
|
-
# === Get story template.
|
48
|
-
# Get a story template info.
|
49
|
-
#
|
50
|
-
# ==== Parameters
|
51
|
-
# id:: (Integer) -- Story template id.
|
52
|
-
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
53
|
-
#
|
54
|
-
# ==== First Example
|
55
|
-
# @data = @cxf_user.get_story_template(2)
|
56
|
-
#
|
57
|
-
# ==== Second Example
|
58
|
-
# options = {
|
59
|
-
# fields: 'title'
|
60
|
-
# }
|
61
|
-
# @data = @cxf_user.get_story_template(1, options)
|
62
|
-
def get_story_template(id, options = nil)
|
63
|
-
@client.raw('get', "/content/story-templates/#{id}", options)
|
64
|
-
end
|
65
|
-
|
66
|
-
# === Create story template.
|
67
|
-
# Create a story template with data.
|
68
|
-
#
|
69
|
-
# ==== Parameters
|
70
|
-
# data:: (Hash) -- Data to be submitted.
|
71
|
-
#
|
72
|
-
# ==== Example
|
73
|
-
# data = {
|
74
|
-
# title: 'New Story Template',
|
75
|
-
# slug: 'new-story-template-slug'
|
76
|
-
# }
|
77
|
-
# @data = @cxf_user.create_story_template(data)
|
78
|
-
def create_story_template(data, options = nil)
|
79
|
-
@client.raw('post', '/content/story-templates', options, data_transform(data))
|
80
|
-
end
|
81
|
-
|
82
|
-
# === Update story template.
|
83
|
-
# Update a story template info.
|
84
|
-
#
|
85
|
-
# ==== Parameters
|
86
|
-
# id:: (Integer) -- Story template id.
|
87
|
-
# data:: (Hash) -- Data to be submitted.
|
88
|
-
#
|
89
|
-
# ==== Example
|
90
|
-
# data = {
|
91
|
-
# title: 'New Story Template Modified'
|
92
|
-
# }
|
93
|
-
# @data = @cxf_user.update_story_template(3, data)
|
94
|
-
def update_story_template(id, data)
|
95
|
-
@client.raw('put', "/content/story-templates/#{id}", nil, data_transform(data))
|
96
|
-
end
|
97
|
-
end
|
@@ -1,171 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Locations
|
4
|
-
##
|
5
|
-
# == Locations
|
6
|
-
#
|
7
|
-
|
8
|
-
# === Get locations.
|
9
|
-
# Get a collection of locations.
|
10
|
-
#
|
11
|
-
# ==== Parameters
|
12
|
-
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
13
|
-
#
|
14
|
-
# ==== First Example
|
15
|
-
# @data = @cxf_user.get_locations
|
16
|
-
#
|
17
|
-
# ==== Second Example
|
18
|
-
# options = {
|
19
|
-
# fields: 'id, title'
|
20
|
-
# }
|
21
|
-
# @data = @cxf_user.get_locations(options)
|
22
|
-
def get_locations(options = nil, use_post = true)
|
23
|
-
get_query_results('/ecommerce/locations', options, use_post)
|
24
|
-
end
|
25
|
-
|
26
|
-
# === Get location.
|
27
|
-
# Get a location info.
|
28
|
-
#
|
29
|
-
# ==== Parameters
|
30
|
-
# id:: (Integer) -- Location id.
|
31
|
-
#
|
32
|
-
# ==== Example
|
33
|
-
# @data = @cxf_user.get_location(2)
|
34
|
-
def get_location(id, options = nil)
|
35
|
-
@client.raw('get', "/ecommerce/locations/#{id}", options)
|
36
|
-
end
|
37
|
-
|
38
|
-
# === Create location.
|
39
|
-
# Create a location with data.
|
40
|
-
#
|
41
|
-
# ==== Parameters
|
42
|
-
# data:: (Hash) -- Data to be submitted.
|
43
|
-
#
|
44
|
-
# ==== Example
|
45
|
-
# data = {
|
46
|
-
# title: 'New Location',
|
47
|
-
# location_template_id: 1
|
48
|
-
# }
|
49
|
-
# @data = @cxf_user.create_location(data)
|
50
|
-
def create_location(data, options = nil)
|
51
|
-
@client.raw('post', '/ecommerce/locations', options, data_transform(data))
|
52
|
-
end
|
53
|
-
|
54
|
-
# === Update location.
|
55
|
-
# Update a location info.
|
56
|
-
#
|
57
|
-
# ==== Parameters
|
58
|
-
# id:: (Integer) -- Location id.
|
59
|
-
# data:: (Hash) -- Data to be submitted.
|
60
|
-
#
|
61
|
-
# ==== Example
|
62
|
-
# data = {
|
63
|
-
# title: 'New Location Modified'
|
64
|
-
# }
|
65
|
-
# @data = @cxf_user.update_location(5, data)
|
66
|
-
def update_location(id, data, options = nil)
|
67
|
-
@client.raw('put', "/ecommerce/locations/#{id}", options, data_transform(data))
|
68
|
-
end
|
69
|
-
|
70
|
-
# === Delete location.
|
71
|
-
# Delete a location.
|
72
|
-
#
|
73
|
-
# ==== Parameters
|
74
|
-
# id:: (Integer) -- Location id.
|
75
|
-
#
|
76
|
-
# ==== Example
|
77
|
-
# @data = @cxf_user.delete_location(5)
|
78
|
-
def delete_location(id)
|
79
|
-
@client.raw('delete', "/ecommerce/locations/#{id}")
|
80
|
-
end
|
81
|
-
|
82
|
-
##
|
83
|
-
# == Locations Templates
|
84
|
-
#
|
85
|
-
|
86
|
-
# === Get location template support data.
|
87
|
-
# Get support data used in a location template.
|
88
|
-
#
|
89
|
-
# ==== Parameters
|
90
|
-
# id:: (Integer) -- Location template id.
|
91
|
-
#
|
92
|
-
# ==== Example
|
93
|
-
# @data = @cxf_user.get_location_template_support_data(1)
|
94
|
-
def get_location_template_support_data(id)
|
95
|
-
@client.raw('get', "/ecommerce/location-templates/#{id}/support-data")
|
96
|
-
end
|
97
|
-
|
98
|
-
# === Get location templates support data.
|
99
|
-
# Get support data used in location templates.
|
100
|
-
#
|
101
|
-
# ==== Example
|
102
|
-
# @data = @cxf_user.get_location_templates_support_data
|
103
|
-
def get_location_templates_support_data
|
104
|
-
@client.raw('get', '/ecommerce/location-templates/support-data')
|
105
|
-
end
|
106
|
-
|
107
|
-
# === Get location templates.
|
108
|
-
# Get a collection of location templates.
|
109
|
-
#
|
110
|
-
# ==== Parameters
|
111
|
-
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
112
|
-
#
|
113
|
-
# ==== First Example
|
114
|
-
# @data = @cxf_user.get_location_templates
|
115
|
-
#
|
116
|
-
# ==== Second Example
|
117
|
-
# options = { fields: 'title' }
|
118
|
-
# @data = @cxf_user.get_location_templates(options)
|
119
|
-
def get_location_templates(options = nil)
|
120
|
-
@client.raw('get', '/ecommerce/location-templates', options)
|
121
|
-
end
|
122
|
-
|
123
|
-
# === Get location template.
|
124
|
-
# Get a location template info.
|
125
|
-
#
|
126
|
-
# ==== Parameters
|
127
|
-
# id:: (Integer) -- Location template id.
|
128
|
-
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
129
|
-
#
|
130
|
-
# ==== First Example
|
131
|
-
# @data = @cxf_user.get_location_template(1)
|
132
|
-
#
|
133
|
-
# ==== Second Example
|
134
|
-
# options = { fields: 'title' }
|
135
|
-
# @data = @cxf_user.get_location_template(1, options)
|
136
|
-
def get_location_template(id, options = nil)
|
137
|
-
@client.raw('get', "/ecommerce/location-templates/#{id}", options)
|
138
|
-
end
|
139
|
-
|
140
|
-
# === Create location template.
|
141
|
-
# Create a location template with data.
|
142
|
-
#
|
143
|
-
# ==== Parameters
|
144
|
-
# data:: (Hash) -- Data to be submitted.
|
145
|
-
#
|
146
|
-
# ==== Example
|
147
|
-
# data = {
|
148
|
-
# title: 'New Location Template',
|
149
|
-
# slug: 'new-location-template'
|
150
|
-
# }
|
151
|
-
# @data = @cxf_user.create_location_template(data)
|
152
|
-
def create_location_template(data)
|
153
|
-
@client.raw('post', '/ecommerce/location-templates', nil, data_transform(data))
|
154
|
-
end
|
155
|
-
|
156
|
-
# === Update location template.
|
157
|
-
# Update a location template info.
|
158
|
-
#
|
159
|
-
# ==== Parameters
|
160
|
-
# id:: (Integer) -- Location template id.
|
161
|
-
# data:: (Hash) -- Data to be submitted.
|
162
|
-
#
|
163
|
-
# ==== Example
|
164
|
-
# data = {
|
165
|
-
# title: 'New Location Template Modified'
|
166
|
-
# }
|
167
|
-
# @data = @cxf_user.update_location_template(3, data)
|
168
|
-
def update_location_template(id, data)
|
169
|
-
@client.raw('put', "/ecommerce/location-templates/#{id}", nil, data_transform(data))
|
170
|
-
end
|
171
|
-
end
|