cxf 0.0.1 → 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 +20 -9
- data/lib/contact.rb +4 -1
- data/lib/cxf/controllers/concerns/cxf_clients.rb +16 -7
- data/lib/cxf/helpers/contact_auth_helper.rb +1 -1
- data/lib/cxf/helpers/proxy_controllers_methods.rb +1 -2
- 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 +4 -0
- data/lib/user/content/content.rb +6 -6
- data/lib/user/content/content_bundles.rb +95 -0
- data/lib/user/content/content_prints.rb +95 -0
- data/lib/user/ecommerce/ecommerce.rb +0 -2
- data/lib/user.rb +4 -2
- metadata +9 -8
- 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
@@ -13,7 +13,7 @@ module Cxf
|
|
13
13
|
include CxfHelper
|
14
14
|
|
15
15
|
attr_reader :host, :mode, :api_key, :scope, :base_url
|
16
|
-
attr_accessor :session_token, :refresh_token, :contact_token_id, :session_token_expires_at, :refresh_token_expires_at
|
16
|
+
attr_accessor :session_token, :refresh_token, :contact_token_id, :session_token_expires_at, :refresh_token_expires_at, :user_agent
|
17
17
|
|
18
18
|
def initialize(
|
19
19
|
host,
|
@@ -36,6 +36,7 @@ module Cxf
|
|
36
36
|
@contact_token_id = contact_token_id
|
37
37
|
@visit_id = visit_id
|
38
38
|
@debug = debug
|
39
|
+
@user_agent = nil
|
39
40
|
|
40
41
|
config = read_config_file('sdk') || {}
|
41
42
|
|
@@ -148,8 +149,7 @@ module Cxf
|
|
148
149
|
replace_tokens(response)
|
149
150
|
end
|
150
151
|
|
151
|
-
verify_response_status(response, config['sdk']['ignore_http_errors'])
|
152
|
-
|
152
|
+
response = verify_response_status(response, config['sdk']['ignore_http_errors'])
|
153
153
|
begin
|
154
154
|
if @debug
|
155
155
|
response_from = if result_from_cache
|
@@ -360,6 +360,7 @@ module Cxf
|
|
360
360
|
h['ContactToken'] = @contact_token_id if @contact_token_id
|
361
361
|
h['Visit-Id'] = @visit_id if @visit_id
|
362
362
|
h['Authorization'] = "Bearer #{@session_token}" if @session_token
|
363
|
+
h['User-Agent'] = @user_agent if @user_agent
|
363
364
|
|
364
365
|
if headers
|
365
366
|
headers.each do |k, v|
|
@@ -379,16 +380,26 @@ module Cxf
|
|
379
380
|
|
380
381
|
if !is_success and !ignore_http_errors
|
381
382
|
title = "Request failed with status #{http_status}"
|
382
|
-
detail = response&.response&.message || 'Unknown error'
|
383
|
+
detail = response&.parsed_response["message"] ||response&.response&.message || 'Unknown error'
|
383
384
|
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
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
|
388
390
|
|
389
|
-
|
391
|
+
response = JSON.generate(
|
392
|
+
{
|
393
|
+
'error' => {
|
394
|
+
'title' => title,
|
395
|
+
'status' => http_status
|
396
|
+
},
|
397
|
+
'message' => detail
|
398
|
+
}
|
399
|
+
)
|
390
400
|
end
|
391
401
|
end
|
402
|
+
response
|
392
403
|
end
|
393
404
|
|
394
405
|
# Timeouts methods
|
data/lib/contact.rb
CHANGED
@@ -37,6 +37,7 @@ module Cxf
|
|
37
37
|
refresh_token = nil,
|
38
38
|
contact_token_id = nil,
|
39
39
|
debug = false,
|
40
|
+
user_agent = nil,
|
40
41
|
timeouts = {}
|
41
42
|
)
|
42
43
|
@contact_v1_url = '/api/contact/v1'
|
@@ -51,6 +52,8 @@ module Cxf
|
|
51
52
|
debug,
|
52
53
|
timeouts
|
53
54
|
)
|
55
|
+
|
56
|
+
@client.user_agent = user_agent
|
54
57
|
end
|
55
58
|
|
56
59
|
### V1/CONTACTS ###
|
@@ -206,7 +209,7 @@ module Cxf
|
|
206
209
|
# }
|
207
210
|
# @data = @cxf_contact.me(options)
|
208
211
|
def me(options = nil)
|
209
|
-
@client.raw('get', '/me', options, nil
|
212
|
+
@client.raw('get', '/contacts/me', options, nil)
|
210
213
|
end
|
211
214
|
|
212
215
|
##
|
@@ -45,13 +45,15 @@ module CxfClients
|
|
45
45
|
# Initialize cxf pub client, credentials taken from cxf_config.yml.erb file
|
46
46
|
visit_id = cookies[:cxf_visit_id]
|
47
47
|
contact_token_id = cookies[:cxf_contact_id]
|
48
|
+
user_agent = request.user_agent
|
48
49
|
|
49
50
|
@cxf_pub = Cxf::Pub.new(
|
50
51
|
@host,
|
51
52
|
@api_key,
|
52
53
|
contact_token_id,
|
53
54
|
visit_id,
|
54
|
-
@debug
|
55
|
+
@debug,
|
56
|
+
user_agent
|
55
57
|
)
|
56
58
|
end
|
57
59
|
|
@@ -62,14 +64,16 @@ module CxfClients
|
|
62
64
|
# Initialize cxf contact client
|
63
65
|
contact_session_token = cookies[:cxf_contact_session_token]
|
64
66
|
contact_refresh_token = cookies[:cxf_contact_refresh_token]
|
65
|
-
contact_token_id = cookies[:cxf_contact_id]
|
67
|
+
contact_token_id = cookies[:cxf_contact_id] || nil
|
68
|
+
user_agent = request.user_agent
|
66
69
|
@cxf_contact = Cxf::Contact.new(
|
67
70
|
@host,
|
68
71
|
@api_key,
|
69
72
|
contact_session_token,
|
70
73
|
contact_refresh_token,
|
71
74
|
contact_token_id,
|
72
|
-
@debug
|
75
|
+
@debug,
|
76
|
+
user_agent
|
73
77
|
)
|
74
78
|
end
|
75
79
|
|
@@ -80,12 +84,14 @@ module CxfClients
|
|
80
84
|
# Initialize cxf user client
|
81
85
|
user_session_token = cookies[:cxf_user_session_token]
|
82
86
|
user_refresh_token = cookies[:cxf_user_refresh_token]
|
87
|
+
user_agent = request.user_agent
|
83
88
|
@cxf_user = Cxf::User.new(
|
84
89
|
@host,
|
85
90
|
@api_key,
|
86
91
|
user_session_token,
|
87
92
|
user_refresh_token,
|
88
|
-
@debug
|
93
|
+
@debug,
|
94
|
+
user_agent
|
89
95
|
)
|
90
96
|
end
|
91
97
|
|
@@ -94,11 +100,14 @@ module CxfClients
|
|
94
100
|
# Initialize the service account client
|
95
101
|
def set_cxf_service_account_client
|
96
102
|
# Initialize service account client
|
103
|
+
user_agent = request.user_agent
|
97
104
|
@cxf_service_account = Cxf::User.new(
|
98
105
|
@host,
|
99
|
-
@api_key,
|
100
|
-
@api_key,
|
101
|
-
@
|
106
|
+
@api_key, # api token
|
107
|
+
@api_key, # session token
|
108
|
+
@api_key, # refresh token
|
109
|
+
@debug,
|
110
|
+
user_agent
|
102
111
|
)
|
103
112
|
end
|
104
113
|
end
|
@@ -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 }
|
@@ -25,8 +25,7 @@ module ProxyControllersMethods
|
|
25
25
|
'host' => host,
|
26
26
|
'ApiKey' => @api_key.to_s,
|
27
27
|
'Content-Type' => 'application/json',
|
28
|
-
'Accept' => 'application/json'
|
29
|
-
'SDK' => 'true',
|
28
|
+
'Accept' => 'application/json'
|
30
29
|
}
|
31
30
|
|
32
31
|
if %w[contact user].include? controller_type
|
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
@@ -87,6 +87,7 @@ module Cxf
|
|
87
87
|
contact_token_id = nil,
|
88
88
|
visit_id = nil,
|
89
89
|
debug = false,
|
90
|
+
user_agent = nil,
|
90
91
|
timeouts = {}
|
91
92
|
)
|
92
93
|
@client = Cxf::Client.new(
|
@@ -94,11 +95,14 @@ module Cxf
|
|
94
95
|
api_key,
|
95
96
|
'public',
|
96
97
|
nil,
|
98
|
+
nil,
|
97
99
|
contact_token_id,
|
98
100
|
visit_id,
|
99
101
|
debug,
|
100
102
|
timeouts
|
101
103
|
)
|
104
|
+
|
105
|
+
@client.user_agent = user_agent
|
102
106
|
end
|
103
107
|
|
104
108
|
##
|
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.
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module ContentBundles
|
3
|
+
# === Get content bundle.
|
4
|
+
# Get a collection of content bundle.
|
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_bundles
|
12
|
+
#
|
13
|
+
# ==== Second Example
|
14
|
+
# options = {
|
15
|
+
# fields: 'id, slug'
|
16
|
+
# }
|
17
|
+
# @data = @cxf_user.get_content_bundles(options)
|
18
|
+
#
|
19
|
+
# ==== Third Example
|
20
|
+
# options = {
|
21
|
+
# fields: 'id, slug'
|
22
|
+
# }
|
23
|
+
# @data = @cxf_user.get_content_bundles(options, true)
|
24
|
+
def get_content_bundles(options = nil, use_post = true)
|
25
|
+
get_query_results('/content/content-bundles', options, use_post)
|
26
|
+
end
|
27
|
+
|
28
|
+
# === Get content bundle.
|
29
|
+
# Get a content bundle info.
|
30
|
+
#
|
31
|
+
# ==== Parameters
|
32
|
+
# id:: (Integer) -- content bundle 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_bundle(1)
|
37
|
+
#
|
38
|
+
# ==== Second Example
|
39
|
+
# options = {
|
40
|
+
# fields: 'id, slug'
|
41
|
+
# }
|
42
|
+
# @data = @cxf_user.get_content_bundle(1, options)
|
43
|
+
def get_content_bundle(id, options = nil)
|
44
|
+
@client.raw('get', "/content/content-bundles/#{id}", options)
|
45
|
+
end
|
46
|
+
|
47
|
+
# === Create content bundle.
|
48
|
+
# Create a content bundle 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 bundle",
|
57
|
+
# content bundle_template_id: 1
|
58
|
+
# }
|
59
|
+
#
|
60
|
+
# options = { fields: 'id,slug' }
|
61
|
+
#
|
62
|
+
# @data = @cxf_user.create_content_bundle(data, options)
|
63
|
+
def create_content_bundle(data, options = nil)
|
64
|
+
@client.raw('post', '/content/content-bundles', options, data_transform(data))
|
65
|
+
end
|
66
|
+
|
67
|
+
# === Update content bundle.
|
68
|
+
# Update a content bundle info.
|
69
|
+
#
|
70
|
+
# ==== Parameters
|
71
|
+
# id:: (Integer) -- content bundle id.
|
72
|
+
# data:: (Hash) -- Data to be submitted.
|
73
|
+
#
|
74
|
+
# ==== Example
|
75
|
+
# data = {
|
76
|
+
# user_id: 1,
|
77
|
+
# slug: 'new-content bundle'
|
78
|
+
# }
|
79
|
+
# @data = @cxf_user.update_content_bundle(5, data)
|
80
|
+
def update_content_bundle(id, data, options = nil)
|
81
|
+
@client.raw('put', "/content/content-bundles/#{id}", options, data_transform(data))
|
82
|
+
end
|
83
|
+
|
84
|
+
# === Delete content bundle.
|
85
|
+
# Delete a content bundle.
|
86
|
+
#
|
87
|
+
# ==== Parameters
|
88
|
+
# id:: (Integer) -- content bundle id.
|
89
|
+
#
|
90
|
+
# ==== Example
|
91
|
+
# @data = @cxf_user.delete_content_bundle(6)
|
92
|
+
def delete_content_bundle(id)
|
93
|
+
@client.raw('delete', "/content/content-bundles/#{id}")
|
94
|
+
end
|
95
|
+
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)
|
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}")
|
94
|
+
end
|
95
|
+
end
|
@@ -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
|
data/lib/user.rb
CHANGED
@@ -51,7 +51,7 @@ module Cxf
|
|
51
51
|
|
52
52
|
attr_reader :client
|
53
53
|
|
54
|
-
def initialize(host, api_key, session_token = nil, refresh_token = nil, debug = false, timeouts = {})
|
54
|
+
def initialize(host, api_key, session_token = nil, refresh_token = nil, debug = false, user_agent = nil, timeouts = {})
|
55
55
|
@client = Cxf::Client.new(
|
56
56
|
host,
|
57
57
|
api_key,
|
@@ -61,8 +61,10 @@ module Cxf
|
|
61
61
|
nil,
|
62
62
|
nil,
|
63
63
|
debug,
|
64
|
-
timeouts
|
64
|
+
timeouts,
|
65
65
|
)
|
66
|
+
|
67
|
+
@client.user_agent = user_agent
|
66
68
|
end
|
67
69
|
|
68
70
|
def login(email, password)
|
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
|
@@ -174,17 +176,16 @@ files:
|
|
174
176
|
- lib/user/content/block_templates.rb
|
175
177
|
- lib/user/content/blocks.rb
|
176
178
|
- lib/user/content/content.rb
|
179
|
+
- lib/user/content/content_bundles.rb
|
180
|
+
- lib/user/content/content_prints.rb
|
177
181
|
- lib/user/content/instances.rb
|
178
182
|
- lib/user/content/print_versions.rb
|
179
|
-
- lib/user/content/stories.rb
|
180
|
-
- lib/user/content/story_templates.rb
|
181
183
|
- lib/user/content/templates.rb
|
182
184
|
- lib/user/crm/companies.rb
|
183
185
|
- lib/user/crm/contacts.rb
|
184
186
|
- lib/user/crm/crm.rb
|
185
187
|
- lib/user/ecommerce/ecommerce.rb
|
186
188
|
- lib/user/ecommerce/item_prices.rb
|
187
|
-
- lib/user/ecommerce/locations.rb
|
188
189
|
- lib/user/ecommerce/price_lists.rb
|
189
190
|
- lib/user/ecommerce/product_templates.rb
|
190
191
|
- lib/user/ecommerce/product_variations.rb
|
@@ -220,8 +221,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
221
|
- !ruby/object:Gem::Version
|
221
222
|
version: '0'
|
222
223
|
requirements: []
|
223
|
-
rubygems_version: 3.5.
|
224
|
+
rubygems_version: 3.5.18
|
224
225
|
signing_key:
|
225
226
|
specification_version: 4
|
226
|
-
summary:
|
227
|
+
summary: CXF gem allows to connect your Rails App to the Customer Experience Framework.
|
227
228
|
test_files: []
|
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
|