cxf 0.0.4 → 0.0.6
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/Gemfile +11 -11
- data/lib/client.rb +22 -11
- data/lib/contact/content/content.rb +4 -4
- data/lib/contact/ecommerce/ecommerce.rb +4 -4
- data/lib/contact.rb +2 -0
- data/lib/cxf/controllers/concerns/cxf_clients.rb +4 -4
- data/lib/cxf/helpers/contact_auth_helper.rb +16 -15
- data/lib/cxf/helpers/proxy_controllers_methods.rb +20 -8
- data/lib/cxf/helpers/user_auth_helper.rb +13 -14
- data/lib/pub/config/config.rb +6 -6
- data/lib/pub/ecommerce/ecommerce.rb +6 -6
- data/lib/user/config/config.rb +10 -0
- data/lib/user/config/docs.rb +11 -0
- data/lib/user/config/exports.rb +43 -0
- data/lib/user/config/logs.rb +85 -0
- data/lib/user/config/password.rb +7 -0
- data/lib/user/config/relationships.rb +17 -31
- data/lib/user/config/seeds.rb +4 -48
- data/lib/user/config/system_settings.rb +5 -5
- data/lib/user/config/views.rb +24 -0
- data/lib/user/content/assets.rb +27 -221
- data/lib/user/content/bundles.rb +96 -0
- data/lib/user/content/content.rb +6 -0
- data/lib/user/content/instances.rb +37 -0
- data/lib/user/content/message_templates.rb +114 -0
- data/lib/user/content/print_versions.rb +18 -0
- data/lib/user/content/prints.rb +96 -0
- data/lib/user/content/templates.rb +28 -0
- data/lib/user/{crm → customer-data}/companies.rb +6 -6
- data/lib/user/{crm → customer-data}/contacts.rb +43 -18
- data/lib/user/customer-data/customer_data.rb +17 -0
- data/lib/user/customer-data/profiles.rb +93 -0
- data/lib/user/customer-data/segments.rb +93 -0
- data/lib/user/customer-data/workflow_steps.rb +127 -0
- data/lib/user/customer-data/workflows.rb +115 -0
- data/lib/user/ecommerce/ecommerce.rb +6 -22
- data/lib/user/ecommerce/item_codes.rb +89 -0
- data/lib/user/ecommerce/order_templates.rb +89 -0
- data/lib/user/ecommerce/orders.rb +205 -0
- data/lib/user/helpers/helpers.rb +0 -96
- data/lib/user.rb +4 -4
- metadata +18 -19
- data/lib/user/contacts/contacts.rb +0 -22
- data/lib/user/crm/crm.rb +0 -9
- data/lib/user/ecommerce/item_prices.rb +0 -89
- data/lib/user/ecommerce/price_lists.rb +0 -75
- data/lib/user/ecommerce/product_templates.rb +0 -106
- data/lib/user/ecommerce/product_variations.rb +0 -133
- data/lib/user/ecommerce/product_versions.rb +0 -107
- data/lib/user/ecommerce/products.rb +0 -156
- data/lib/user/ecommerce/skus.rb +0 -90
- data/lib/user/ecommerce/taxes.rb +0 -84
- data/lib/user/ecommerce/variant_options.rb +0 -71
- data/lib/user/ecommerce/variant_values.rb +0 -74
- data/lib/user/ecommerce/vouchers.rb +0 -90
- data/lib/user/helpers/object_activities.rb +0 -85
- data/lib/user/helpers/object_folders.rb +0 -84
- data/lib/user/helpers/user_folders.rb +0 -85
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f4d4438ad88e14b53649c99f16ade67766fe99131d5be687e0c45da71d7ffbc
|
4
|
+
data.tar.gz: b4c881f37d39e448ee993c87e26f1b3722a344d6a5f06f455b733867d24c91f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b806f588681360912cbdf98932d6f061e64407158a898c56de54a9262461fe7d519688784b0af1b240745f7fa45b493878f04c6cb09400be79ca43f1d6bebd0
|
7
|
+
data.tar.gz: b09c53002f03c0ad50b8a93610b71c1ee8ba3fa474acb155c59f7175207f6cae7d1f85fc6c6734e23acc669af1e37312192eebeaaee27f1fe4bde48d942bcb88
|
data/Gemfile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
source :rubygems
|
2
|
-
|
3
|
-
gem 'json'
|
4
|
-
gem 'httparty'
|
5
|
-
gem 'addressable'
|
6
|
-
gem 'rails-reverse-proxy', '~> 0.9.1'
|
7
|
-
gem 'redis'
|
8
|
-
gem 'mongo', "~> 2"
|
9
|
-
gem 'concurrent-ruby', require: 'concurrent'
|
10
|
-
gem 'rubocop', require: false
|
11
|
-
gem 'rack', '~> 2.2.0'
|
1
|
+
source :rubygems
|
2
|
+
|
3
|
+
gem 'json'
|
4
|
+
gem 'httparty'
|
5
|
+
gem 'addressable'
|
6
|
+
gem 'rails-reverse-proxy', '~> 0.9.1'
|
7
|
+
gem 'redis'
|
8
|
+
gem 'mongo', "~> 2"
|
9
|
+
gem 'concurrent-ruby', require: 'concurrent'
|
10
|
+
gem 'rubocop', require: false
|
11
|
+
gem 'rack', '~> 2.2.0'
|
12
12
|
gem 'rack-test', '~> 1.1.0'
|
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, :
|
16
|
+
attr_accessor :session_token, :refresh_token, :contact_token_id, :user_agent
|
17
17
|
|
18
18
|
def initialize(
|
19
19
|
host,
|
@@ -30,9 +30,7 @@ module Cxf
|
|
30
30
|
@host = host
|
31
31
|
@api_key = api_key
|
32
32
|
@session_token = session_token
|
33
|
-
@session_token_expires_at = nil
|
34
33
|
@refresh_token = refresh_token
|
35
|
-
@refresh_token_expires_at = nil
|
36
34
|
@contact_token_id = contact_token_id
|
37
35
|
@visit_id = visit_id
|
38
36
|
@debug = debug
|
@@ -80,7 +78,7 @@ module Cxf
|
|
80
78
|
found_options_with_encoding = options.keys.select { |key| need_encoding.include?(key.to_s.downcase) and options[key]&.class == Hash }
|
81
79
|
|
82
80
|
found_options_with_encoding.each do |key|
|
83
|
-
options[key] =
|
81
|
+
options[key] = Base64.encode64(options[key].to_json)
|
84
82
|
end
|
85
83
|
|
86
84
|
uri = Addressable::URI.new
|
@@ -259,7 +257,7 @@ module Cxf
|
|
259
257
|
def replacements
|
260
258
|
[
|
261
259
|
{ old_value: '_', new_value: '-' },
|
262
|
-
{ old_value: 'people', new_value: '
|
260
|
+
{ old_value: 'people', new_value: 'customer-data' },
|
263
261
|
{ old_value: 'store', new_value: 'ecommerce' }
|
264
262
|
]
|
265
263
|
end
|
@@ -380,7 +378,7 @@ module Cxf
|
|
380
378
|
|
381
379
|
if !is_success and !ignore_http_errors
|
382
380
|
title = "Request failed with status #{http_status}"
|
383
|
-
detail = response&.parsed_response["message"] ||response&.response&.message || 'Unknown error'
|
381
|
+
detail = response&.parsed_response["message"] || response&.response&.message || 'Unknown error'
|
384
382
|
|
385
383
|
if @debug
|
386
384
|
puts "Error detected: #{http_status}"
|
@@ -447,12 +445,25 @@ module Cxf
|
|
447
445
|
return unless response&.headers
|
448
446
|
|
449
447
|
# Return if the response does not have headers Access-Token and Refresh-Token
|
450
|
-
return unless response.headers.key?('
|
448
|
+
return unless response.headers.key?('Set-Cookie')
|
449
|
+
parsed_cookie = parse_set_cookie(response.headers['Set-Cookie'])
|
450
|
+
return unless parsed_cookie['Access-Token'] || parsed_cookie['Refresh-Token']
|
451
451
|
|
452
|
-
@session_token =
|
453
|
-
@refresh_token =
|
454
|
-
|
455
|
-
|
452
|
+
@session_token = parsed_cookie['Access-Token'] if parsed_cookie['Access-Token']
|
453
|
+
@refresh_token = parsed_cookie['Refresh-Token'] if parsed_cookie['Refresh-Token']
|
454
|
+
end
|
455
|
+
|
456
|
+
def parse_set_cookie(set_cookie)
|
457
|
+
set_cookie = set_cookie.split(', ')
|
458
|
+
cookies_hash = {}
|
459
|
+
|
460
|
+
set_cookie.each do |cookie|
|
461
|
+
key, value = cookie.split('=')
|
462
|
+
value = value.split(';')[0]
|
463
|
+
cookies_hash[key] = value
|
464
|
+
end
|
465
|
+
|
466
|
+
cookies_hash
|
456
467
|
end
|
457
468
|
end
|
458
469
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ContactContent
|
4
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ContactContent
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ContactEcommerce
|
4
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ContactEcommerce
|
4
|
+
end
|
data/lib/contact.rb
CHANGED
@@ -93,6 +93,8 @@ module Cxf
|
|
93
93
|
password: password
|
94
94
|
}
|
95
95
|
response = @client.raw('post', '/contacts/login', nil, data_transform(data))
|
96
|
+
|
97
|
+
return response unless response.is_a? Hash
|
96
98
|
if response.key? 'data' and response['data'].key? 'access_token'
|
97
99
|
@client.session_token = response['data']['access_token']
|
98
100
|
@client.refresh_token = response['data']['refresh_token']
|
@@ -62,8 +62,8 @@ module CxfClients
|
|
62
62
|
# Initialize the contact client and set the contact token
|
63
63
|
def set_cxf_contact_client
|
64
64
|
# Initialize cxf contact client
|
65
|
-
contact_session_token = cookies[
|
66
|
-
contact_refresh_token = cookies[
|
65
|
+
contact_session_token = cookies["cxf_contact_session_token"]
|
66
|
+
contact_refresh_token = cookies["cxf_contact_refresh_token"]
|
67
67
|
contact_token_id = cookies[:cxf_contact_id] || nil
|
68
68
|
user_agent = request.user_agent
|
69
69
|
@cxf_contact = Cxf::Contact.new(
|
@@ -82,8 +82,8 @@ module CxfClients
|
|
82
82
|
# Initialize the user client
|
83
83
|
def set_cxf_user_client
|
84
84
|
# Initialize cxf user client
|
85
|
-
user_session_token = cookies[
|
86
|
-
user_refresh_token = cookies[
|
85
|
+
user_session_token = cookies["cxf_user_session_token"]
|
86
|
+
user_refresh_token = cookies["cxf_user_refresh_token"]
|
87
87
|
user_agent = request.user_agent
|
88
88
|
@cxf_user = Cxf::User.new(
|
89
89
|
@host,
|
@@ -7,15 +7,18 @@ module ContactAuthHelper
|
|
7
7
|
def cxf_contact_login(email, password)
|
8
8
|
# Login in cxf
|
9
9
|
response = @cxf_contact.login(email, password)
|
10
|
+
|
10
11
|
# Get session token from response
|
12
|
+
return response unless response.is_a? Hash
|
11
13
|
if response.key? 'data'
|
12
|
-
session_token = response['data']['
|
14
|
+
session_token = response['data']['access_token']
|
13
15
|
refresh_token = response['data']['refresh_token']
|
14
16
|
id_token = response['data']['contact_token'] || response['data']['id_token'] || nil
|
15
17
|
end
|
18
|
+
|
16
19
|
# Set a permanent cookie with the session token
|
17
|
-
cookies.permanent[
|
18
|
-
cookies.permanent[
|
20
|
+
cookies.permanent["cxf_contact_session_token"] = { value: session_token, secure: true, httponly: true }
|
21
|
+
cookies.permanent["cxf_contact_refresh_token"] = { value: refresh_token, secure: true, httponly: true }
|
19
22
|
# cookies.permanent[:cxf_contact_id] = { value: id_token, secure: true, httponly: true }
|
20
23
|
@contact_token = id_token
|
21
24
|
end
|
@@ -33,8 +36,8 @@ module ContactAuthHelper
|
|
33
36
|
refresh_token = response['data']['refresh_token']
|
34
37
|
# id_token = response['data']['contact']['contact_token'] ? response['data']['contact']['contact_token'] : response['data']['contact']['id_token']
|
35
38
|
# Set a permanent cookie with the session token
|
36
|
-
cookies.permanent[
|
37
|
-
cookies.permanent[
|
39
|
+
cookies.permanent["cxf_contact_session_token"] = { value: session_token, secure: true, httponly: true }
|
40
|
+
cookies.permanent["cxf_contact_refresh_token"] = { value: refresh_token, secure: true, httponly: true }
|
38
41
|
# cookies.permanent[:cxf_contact_id] = { value: id_token, secure: true, httponly: true }
|
39
42
|
# @contact_token = id_token
|
40
43
|
redirect_to response['data']['redirect_url'] || '/' if redirect_in_error
|
@@ -51,8 +54,8 @@ module ContactAuthHelper
|
|
51
54
|
@cxf_contact.logout
|
52
55
|
# Delete session token and keep the contact token id
|
53
56
|
# Never delete the cxf_contact_id cookie to avoid the creation of ghosts
|
54
|
-
cookies.delete(
|
55
|
-
cookies.delete(
|
57
|
+
cookies.delete("cxf_contact_session_token")
|
58
|
+
cookies.delete("cxf_contact_refresh_token")
|
56
59
|
@contact_token = nil
|
57
60
|
end
|
58
61
|
|
@@ -66,8 +69,8 @@ module ContactAuthHelper
|
|
66
69
|
rescue => e
|
67
70
|
# Handle the client Unauthorized error
|
68
71
|
# if cxf response is negative delete the session cookie
|
69
|
-
cookies.delete(
|
70
|
-
cookies.delete(
|
72
|
+
cookies.delete("cxf_contact_session_token")
|
73
|
+
cookies.delete("cxf_contact_refresh_token")
|
71
74
|
status = false
|
72
75
|
end
|
73
76
|
|
@@ -75,12 +78,10 @@ module ContactAuthHelper
|
|
75
78
|
end
|
76
79
|
|
77
80
|
def update_contact_tokens
|
78
|
-
access_token = @
|
79
|
-
refresh_token = @
|
80
|
-
access_token_expires_at = @cxf_user.get_client.session_token_expires_at
|
81
|
-
refresh_token_expires_at = @cxf_user.get_client.refresh_token_expires_at
|
81
|
+
access_token = @cxf_contact.get_client.session_token
|
82
|
+
refresh_token = @cxf_contact.get_client.refresh_token
|
82
83
|
|
83
|
-
cookies[
|
84
|
-
cookies[
|
84
|
+
cookies["cxf_contact_session_token"] = { value: access_token, secure: true, httponly: true} if access_token
|
85
|
+
cookies["cxf_contact_refresh_token"] = { value: refresh_token, secure: true, httponly: true } if refresh_token
|
85
86
|
end
|
86
87
|
end
|
@@ -29,8 +29,8 @@ module ProxyControllersMethods
|
|
29
29
|
}
|
30
30
|
|
31
31
|
if %w[contact user].include? controller_type
|
32
|
-
session_token = cookies["cxf_#{controller_type}_session_token"
|
33
|
-
refresh_token = cookies["cxf_#{controller_type}_refresh_token"
|
32
|
+
session_token = cookies["cxf_#{controller_type}_session_token"]
|
33
|
+
refresh_token = cookies["cxf_#{controller_type}_refresh_token"]
|
34
34
|
headers['Access-Token'] = session_token
|
35
35
|
headers['Refresh-Token'] = refresh_token
|
36
36
|
end
|
@@ -124,12 +124,9 @@ module ProxyControllersMethods
|
|
124
124
|
# set Cookies from response headers
|
125
125
|
if %w[contact user].include? controller_type
|
126
126
|
config.on_response do |_status_code, response|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
# add expires to cookies
|
131
|
-
cookies["cxf_#{controller_type}_session_token".to_sym] = { value: response.header['Access-Token'], secure: true, httponly: true, expires: Time.at(session_token_expires_at) } if response.header['Access-Token']
|
132
|
-
cookies["cxf_#{controller_type}_refresh_token".to_sym] = { value: response.header['Refresh-Token'], secure: true, httponly: true, expires: Time.at(refresh_token_expires_at) } if response.header['Refresh-Token']
|
127
|
+
parsed_cookie = parse_set_cookie(response.header['Set-Cookie'])
|
128
|
+
cookies["cxf_#{controller_type}_session_token"] = { value: parsed_cookie['Access-Token'], secure: true, httponly: true } if parsed_cookie['Access-Token']
|
129
|
+
cookies["cxf_#{controller_type}_refresh_token"] = { value: parsed_cookie['Refresh-Token'], secure: true, httponly: true } if parsed_cookie['Refresh-Token']
|
133
130
|
end
|
134
131
|
end
|
135
132
|
|
@@ -140,4 +137,19 @@ module ProxyControllersMethods
|
|
140
137
|
end
|
141
138
|
end
|
142
139
|
end
|
140
|
+
|
141
|
+
private
|
142
|
+
|
143
|
+
def parse_set_cookie(set_cookie)
|
144
|
+
set_cookie = set_cookie.split(', ')
|
145
|
+
cookies_hash = {}
|
146
|
+
|
147
|
+
set_cookie.each do |cookie|
|
148
|
+
key, value = cookie.split('=')
|
149
|
+
value = value.split(';')[0]
|
150
|
+
cookies_hash[key] = value
|
151
|
+
end
|
152
|
+
|
153
|
+
cookies_hash
|
154
|
+
end
|
143
155
|
end
|
@@ -8,8 +8,8 @@ module UserAuthHelper
|
|
8
8
|
rescue => e
|
9
9
|
# Handle the client Unauthorized error
|
10
10
|
# if cxf response is negative delete the session cookie
|
11
|
-
cookies.delete(
|
12
|
-
cookies.delete(
|
11
|
+
cookies.delete("cxf_user_session_token")
|
12
|
+
cookies.delete("cxf_user_refresh_token")
|
13
13
|
response = nil
|
14
14
|
end
|
15
15
|
|
@@ -23,16 +23,17 @@ module UserAuthHelper
|
|
23
23
|
# Login in cxf
|
24
24
|
response = @cxf_user.login(email, password)
|
25
25
|
# Get session token from response
|
26
|
+
return response unless response.is_a? Hash
|
26
27
|
if response.key? 'data'
|
27
28
|
session_token = response['data']['access_token']
|
28
29
|
refresh_token = response['data']['refresh_token']
|
29
|
-
session_token_expires_at = Time.parse(response['data']['access_token_expires_at'])
|
30
|
-
refresh_token_expires_at = Time.parse(response['data']['refresh_token_expires_at'])
|
30
|
+
# session_token_expires_at = Time.parse(response['data']['access_token_expires_at'])
|
31
|
+
# refresh_token_expires_at = Time.parse(response['data']['refresh_token_expires_at'])
|
31
32
|
end
|
32
33
|
|
33
34
|
# Set a permanent cookie with the session token
|
34
|
-
cookies[
|
35
|
-
cookies[
|
35
|
+
cookies["cxf_user_session_token"] = { value: session_token, secure: true, httponly: true }
|
36
|
+
cookies["cxf_user_refresh_token"] = { value: refresh_token, secure: true, httponly: true}
|
36
37
|
end
|
37
38
|
|
38
39
|
##
|
@@ -43,8 +44,8 @@ module UserAuthHelper
|
|
43
44
|
response = @cxf_user.magic_link_login(hash)
|
44
45
|
if response['data']
|
45
46
|
# Set a cookie with the session token
|
46
|
-
cookies[
|
47
|
-
cookies[
|
47
|
+
cookies["cxf_user_session_token"] = { value: response['data']['access_token'], secure: true, httponly: true }
|
48
|
+
cookies["cxf_user_refresh_token"] = { value: response['data']['refresh_token'], secure: true, httponly: true }
|
48
49
|
redirect_to response['data']['redirect_url'] || '/'
|
49
50
|
else
|
50
51
|
redirect_to '/'
|
@@ -58,17 +59,15 @@ module UserAuthHelper
|
|
58
59
|
# Logout from cxf
|
59
60
|
# @cxf_user.logout
|
60
61
|
# Delete local cookie
|
61
|
-
cookies.delete(
|
62
|
-
cookies.delete(
|
62
|
+
cookies.delete("cxf_user_session_token")
|
63
|
+
cookies.delete("cxf_user_refresh_token")
|
63
64
|
end
|
64
65
|
|
65
66
|
def update_user_tokens
|
66
67
|
access_token = @cxf_user.get_client.session_token
|
67
68
|
refresh_token = @cxf_user.get_client.refresh_token
|
68
|
-
access_token_expires_at = @cxf_user.get_client.session_token_expires_at
|
69
|
-
refresh_token_expires_at = @cxf_user.get_client.refresh_token_expires_at
|
70
69
|
|
71
|
-
cookies[
|
72
|
-
cookies[
|
70
|
+
cookies["cxf_user_session_token"] = { value: access_token, secure: true, httponly: true} if access_token
|
71
|
+
cookies["cxf_user_refresh_token"] = { value: refresh_token, secure: true, httponly: true} if refresh_token
|
73
72
|
end
|
74
73
|
end
|
data/lib/pub/config/config.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
### V1/CONFIG ###
|
4
|
-
|
5
|
-
module PublicConfig
|
6
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
### V1/CONFIG ###
|
4
|
+
|
5
|
+
module PublicConfig
|
6
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
### V1/ECOMMERCE ###
|
4
|
-
|
5
|
-
module PublicEcommerce
|
6
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
### V1/ECOMMERCE ###
|
4
|
+
|
5
|
+
module PublicEcommerce
|
6
|
+
end
|
data/lib/user/config/config.rb
CHANGED
@@ -9,6 +9,11 @@ require_relative './system_settings'
|
|
9
9
|
require_relative './tags'
|
10
10
|
require_relative './taxonomies'
|
11
11
|
require_relative './users'
|
12
|
+
require_relative './docs'
|
13
|
+
require_relative './exports'
|
14
|
+
require_relative './logs'
|
15
|
+
require_relative './password'
|
16
|
+
require_relative './calendars'
|
12
17
|
|
13
18
|
module Config
|
14
19
|
include AttributeGroups
|
@@ -20,4 +25,9 @@ module Config
|
|
20
25
|
include Tags
|
21
26
|
include Taxonomies
|
22
27
|
include Users
|
28
|
+
include Docs
|
29
|
+
include Exports
|
30
|
+
include Logs
|
31
|
+
include Password
|
32
|
+
include Calendars
|
23
33
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Exports
|
4
|
+
# === Get export.
|
5
|
+
# Get a collection of export.
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
9
|
+
#
|
10
|
+
# ==== First Example
|
11
|
+
# @data = @cxf_user.get_export
|
12
|
+
#
|
13
|
+
# ==== Second Example
|
14
|
+
# options = { sort: 'id' }
|
15
|
+
# @data = @cxf_user.get_export(options)
|
16
|
+
def get_exports(options = nil)
|
17
|
+
@client.raw('get', '/config/export', options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# === Get export.
|
21
|
+
# Get an export configuration info.
|
22
|
+
#
|
23
|
+
# ==== Parameters
|
24
|
+
# id:: (Integer) -- Export configuration id.
|
25
|
+
#
|
26
|
+
# ==== Example
|
27
|
+
# @data = @cxf_user.get_export(10)
|
28
|
+
def get_export(id)
|
29
|
+
@client.raw('get', "/config/export/#{id}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# === Get export jobs using view id.
|
33
|
+
# Get a collection of export jobs using a view id.
|
34
|
+
#
|
35
|
+
# ==== Parameters
|
36
|
+
# id:: (Integer) -- View id.
|
37
|
+
#
|
38
|
+
# ==== Example
|
39
|
+
# @data = @cxf_user.get_export_jobs_using_view_id(10)
|
40
|
+
def get_export_jobs_using_view_id(id)
|
41
|
+
@client.raw('get', "/config/export/#{id}/jobs")
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Logs
|
4
|
+
# === Get logs.
|
5
|
+
# Get a collection of logs.
|
6
|
+
#
|
7
|
+
# ==== Parameters
|
8
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
9
|
+
#
|
10
|
+
# ==== First Example
|
11
|
+
# @data = @cxf_user.get_logs
|
12
|
+
#
|
13
|
+
# ==== Second Example
|
14
|
+
# options = { fields: 'id' }
|
15
|
+
# @data = @cxf_user.get_logs(options)
|
16
|
+
def get_logs(options = nil)
|
17
|
+
@client.raw('get', '/config/logs', options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# === Get log.
|
21
|
+
# Get a log info.
|
22
|
+
#
|
23
|
+
# ==== Parameters
|
24
|
+
# id:: (Integer) -- Relationship id.
|
25
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
26
|
+
#
|
27
|
+
# ==== First Example
|
28
|
+
# @data = @cxf_user.get_log(1)
|
29
|
+
#
|
30
|
+
# ==== Second Example
|
31
|
+
# options = { fields: 'id' }
|
32
|
+
# @data = @cxf_user.get_log(1, options)
|
33
|
+
def get_log(id, options = nil)
|
34
|
+
@client.raw('get', "/config/logs/#{id}", options)
|
35
|
+
end
|
36
|
+
|
37
|
+
# === Create log.
|
38
|
+
# Create a log with data.
|
39
|
+
#
|
40
|
+
# ==== Parameters
|
41
|
+
# data:: (Hash) -- Data to be submitted.
|
42
|
+
#
|
43
|
+
# ==== Example
|
44
|
+
# data = {
|
45
|
+
# alias_1: 'eventsCopy',
|
46
|
+
# alias_2: 'ticketsCopy',
|
47
|
+
# object_model_1: 'Story',
|
48
|
+
# object_model_2: 'Product'
|
49
|
+
# }
|
50
|
+
# @data = @cxf_user.create_log(data)
|
51
|
+
def create_log(data)
|
52
|
+
@client.raw('post', '/config/logs', nil, data_transform(data))
|
53
|
+
end
|
54
|
+
|
55
|
+
# === Update log.
|
56
|
+
# Update a log info.
|
57
|
+
#
|
58
|
+
# ==== Parameters
|
59
|
+
# id:: (Integer) -- Relationship id.
|
60
|
+
# data:: (Hash) -- Data to be submitted.
|
61
|
+
#
|
62
|
+
# ==== Example
|
63
|
+
# data = {
|
64
|
+
# alias_1: 'eventsCopyModified',
|
65
|
+
# alias_2: 'ticketsCopyModified',
|
66
|
+
# object_model_1: 'Story',
|
67
|
+
# object_model_2: 'Product'
|
68
|
+
# }
|
69
|
+
# @data = @cxf_user.update_log(5, data)
|
70
|
+
def update_log(id, data)
|
71
|
+
@client.raw('put', "/config/logs/#{id}", nil, data_transform(data))
|
72
|
+
end
|
73
|
+
|
74
|
+
# === Delete log.
|
75
|
+
# Delete a log.
|
76
|
+
#
|
77
|
+
# ==== Parameters
|
78
|
+
# id:: (Integer) -- Relationship id.
|
79
|
+
#
|
80
|
+
# ==== Example
|
81
|
+
# @data = @cxf_user.delete_log(5)
|
82
|
+
def delete_log(id)
|
83
|
+
@client.raw('delete', "/config/logs/#{id}")
|
84
|
+
end
|
85
|
+
end
|
@@ -1,24 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Relationships
|
4
|
-
##
|
5
|
-
# == Relationships
|
6
|
-
#
|
7
|
-
# === Get relationships available for.
|
8
|
-
# Get relationships available.
|
9
|
-
#
|
10
|
-
# ==== Parameters
|
11
|
-
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
12
|
-
#
|
13
|
-
# ==== Example
|
14
|
-
# options = {
|
15
|
-
# objectType: 'contacts'
|
16
|
-
# }
|
17
|
-
# @data = @cxf_user.get_relationships_available_for(options)
|
18
|
-
def get_relationships_available_for(options)
|
19
|
-
@client.raw('get', '/config/relationships/available-for', options)
|
20
|
-
end
|
21
|
-
|
22
4
|
# === Attach relationship.
|
23
5
|
# Attach a relationship.
|
24
6
|
#
|
@@ -28,7 +10,6 @@ module Relationships
|
|
28
10
|
# ==== Example
|
29
11
|
#
|
30
12
|
def attach_relationship(data)
|
31
|
-
# FIXME: Method doesn't work, RelationshipManager cannot access to id attribute.
|
32
13
|
@client.raw('post', '/config/relationships/attach', nil, data_transform(data))
|
33
14
|
end
|
34
15
|
|
@@ -41,21 +22,9 @@ module Relationships
|
|
41
22
|
# ==== Example
|
42
23
|
#
|
43
24
|
def detach_relationship(data)
|
44
|
-
# FIXME: Method doesn't work, RelationshipManager cannot access to id attribute.
|
45
25
|
@client.raw('post', '/config/relationships/detach', nil, data_transform(data))
|
46
26
|
end
|
47
27
|
|
48
|
-
# === Relationship has objects.
|
49
|
-
# Get relationships that has objects.
|
50
|
-
#
|
51
|
-
# ==== Parameters
|
52
|
-
# id:: (Integer) -- Relationship id.
|
53
|
-
#
|
54
|
-
# ==== Example
|
55
|
-
# @data = @cxf_user.relationship_has_objects(1)
|
56
|
-
def relationship_has_objects(id)
|
57
|
-
@client.raw('get', "/config/relationships/#{id}/hasObjects")
|
58
|
-
end
|
59
28
|
|
60
29
|
# === Get relationships.
|
61
30
|
# Get a collection of relationships.
|
@@ -138,4 +107,21 @@ module Relationships
|
|
138
107
|
def delete_relationship(id)
|
139
108
|
@client.raw('delete', "/config/relationships/#{id}")
|
140
109
|
end
|
110
|
+
|
111
|
+
##
|
112
|
+
# === Update relationship pivot fields.
|
113
|
+
# Update pivot fields for relationships.
|
114
|
+
#
|
115
|
+
# ==== Parameters
|
116
|
+
# data:: (Hash) -- Data to be submitted.
|
117
|
+
#
|
118
|
+
# ==== Example
|
119
|
+
# data = {
|
120
|
+
# field_name_1: 'value_1',
|
121
|
+
# field_name_2: 'value_2'
|
122
|
+
# }
|
123
|
+
# @data = @cxf_user.update_relationship_pivot_fields(data)
|
124
|
+
def update_relationship_pivot_fields(data)
|
125
|
+
@client.raw('put', '/config/relationships/pivot-fields', nil, data_transform(data))
|
126
|
+
end
|
141
127
|
end
|