cxf 0.0.2 → 0.0.5

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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +11 -11
  3. data/lib/client.rb +19 -10
  4. data/lib/contact/content/content.rb +4 -4
  5. data/lib/contact/ecommerce/ecommerce.rb +4 -4
  6. data/lib/contact.rb +1 -1
  7. data/lib/cxf/controllers/concerns/cxf_clients.rb +4 -4
  8. data/lib/cxf/helpers/contact_auth_helper.rb +1 -1
  9. data/lib/pub/config/config.rb +6 -6
  10. data/lib/pub/content/assets.rb +2 -2
  11. data/lib/pub/content/content.rb +13 -9
  12. data/lib/pub/content/content_prints.rb +95 -0
  13. data/lib/pub/content/print_versions.rb +98 -0
  14. data/lib/pub/ecommerce/ecommerce.rb +6 -6
  15. data/lib/pub.rb +1 -0
  16. data/lib/user/config/config.rb +10 -0
  17. data/lib/user/config/docs.rb +11 -0
  18. data/lib/user/config/exports.rb +43 -0
  19. data/lib/user/config/logs.rb +85 -0
  20. data/lib/user/config/password.rb +7 -0
  21. data/lib/user/config/relationships.rb +17 -31
  22. data/lib/user/config/seeds.rb +4 -48
  23. data/lib/user/config/system_settings.rb +5 -5
  24. data/lib/user/config/views.rb +24 -0
  25. data/lib/user/content/assets.rb +27 -221
  26. data/lib/user/content/bundles.rb +96 -0
  27. data/lib/user/content/content.rb +12 -6
  28. data/lib/user/content/instances.rb +37 -0
  29. data/lib/user/content/message_templates.rb +114 -0
  30. data/lib/user/content/print_versions.rb +18 -0
  31. data/lib/user/content/prints.rb +96 -0
  32. data/lib/user/content/templates.rb +28 -0
  33. data/lib/user/{crm → customer-data}/companies.rb +6 -6
  34. data/lib/user/{crm → customer-data}/contacts.rb +43 -18
  35. data/lib/user/customer-data/customer_data.rb +17 -0
  36. data/lib/user/customer-data/profiles.rb +93 -0
  37. data/lib/user/customer-data/segments.rb +93 -0
  38. data/lib/user/customer-data/workflow_steps.rb +127 -0
  39. data/lib/user/customer-data/workflows.rb +115 -0
  40. data/lib/user/ecommerce/ecommerce.rb +6 -24
  41. data/lib/user/ecommerce/item_codes.rb +89 -0
  42. data/lib/user/ecommerce/order_templates.rb +89 -0
  43. data/lib/user/ecommerce/orders.rb +205 -0
  44. data/lib/user/helpers/helpers.rb +0 -96
  45. data/lib/user.rb +2 -3
  46. metadata +22 -24
  47. data/lib/user/contacts/contacts.rb +0 -22
  48. data/lib/user/content/stories.rb +0 -110
  49. data/lib/user/content/story_templates.rb +0 -97
  50. data/lib/user/crm/crm.rb +0 -9
  51. data/lib/user/ecommerce/item_prices.rb +0 -89
  52. data/lib/user/ecommerce/locations.rb +0 -171
  53. data/lib/user/ecommerce/price_lists.rb +0 -75
  54. data/lib/user/ecommerce/product_templates.rb +0 -106
  55. data/lib/user/ecommerce/product_variations.rb +0 -133
  56. data/lib/user/ecommerce/product_versions.rb +0 -107
  57. data/lib/user/ecommerce/products.rb +0 -156
  58. data/lib/user/ecommerce/skus.rb +0 -90
  59. data/lib/user/ecommerce/taxes.rb +0 -84
  60. data/lib/user/ecommerce/variant_options.rb +0 -71
  61. data/lib/user/ecommerce/variant_values.rb +0 -74
  62. data/lib/user/ecommerce/vouchers.rb +0 -90
  63. data/lib/user/helpers/object_activities.rb +0 -85
  64. data/lib/user/helpers/object_folders.rb +0 -84
  65. data/lib/user/helpers/user_folders.rb +0 -85
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 749f2ca43fc84fc4dfc3fe5248bb51aa5634bc01d7def8840078326f5098ff2c
4
- data.tar.gz: de5b0d7063346d7389b282321b36d2af03b4a36ed24d6f6640ac6d08b0782446
3
+ metadata.gz: 1c8cbe1cc3db14801bba1018da757262a9dfc3c7fc181aa662cd8587cd22fdd5
4
+ data.tar.gz: 5194302848b46fc2bdafb6de8ebbed78cfe3f7b9f31fe4de37a25e7ccfbcd686
5
5
  SHA512:
6
- metadata.gz: 482019323db909196ba74a904a0c3f23c7751d9221b0ecac27d95032eb63c6db98f133c4d6c87836d91c7254bb5a1bf036d58f63b15f5c992e9cb7d794847884
7
- data.tar.gz: a53ec9b81c34d612008b23e146006bb224b4b2c731e51064e6d7ff3ab0074f3d8cb5abdbf100090c4c62dc50fb1ed14fccf12b00d313225d21f263114b18883d
6
+ metadata.gz: 12490c8b54f73f9d46294f704e39ea6031af993231d43aa4b62c664c3c9457acae14e3a03bddef9340bcc91ca53d91709a77b277f0f4d21c8d6445d237dfb726
7
+ data.tar.gz: e772e7072cf77ae9134dcd2fea2149d4dff0249b706f19b2b318a8bef052b9a1d19060f2bfef125f246e2fd5823c703f7e88f2bfecd0d54040255ae9692fdf67
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
@@ -80,7 +80,7 @@ module Cxf
80
80
  found_options_with_encoding = options.keys.select { |key| need_encoding.include?(key.to_s.downcase) and options[key]&.class == Hash }
81
81
 
82
82
  found_options_with_encoding.each do |key|
83
- options[key] = CGI::escape(Base64.encode64(options[key].to_json))
83
+ options[key] = Base64.encode64(options[key].to_json)
84
84
  end
85
85
 
86
86
  uri = Addressable::URI.new
@@ -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
@@ -260,7 +259,7 @@ module Cxf
260
259
  def replacements
261
260
  [
262
261
  { old_value: '_', new_value: '-' },
263
- { old_value: 'people', new_value: 'crm' },
262
+ { old_value: 'people', new_value: 'customer-data' },
264
263
  { old_value: 'store', new_value: 'ecommerce' }
265
264
  ]
266
265
  end
@@ -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
- puts "Error detected: #{http_status}" if @debug
387
- error_class = Errors::DynamicError.new(self, title, detail, http_status, response&.parsed_response)
388
-
389
- raise error_class if @debug
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
- raise error_class.error
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
@@ -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
@@ -209,7 +209,7 @@ module Cxf
209
209
  # }
210
210
  # @data = @cxf_contact.me(options)
211
211
  def me(options = nil)
212
- @client.raw('get', '/me', options, nil, @contact_v1_url)
212
+ @client.raw('get', '/contacts/me', options, nil)
213
213
  end
214
214
 
215
215
  ##
@@ -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 }
@@ -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
@@ -10,7 +10,7 @@ module PublicAssets
10
10
  #
11
11
  # ==== Example
12
12
  # @data = @cxf_pub.get_asset_info("asset_slug")
13
- def get_asset_info(slug)
14
- @client.raw('get', "/content/asset-info/#{slug}")
13
+ def get_public_asset(slug)
14
+ @client.raw('get', "public-assets/#{slug}", nil, nil, '/')
15
15
  end
16
16
  end
@@ -1,9 +1,13 @@
1
- # frozen_string_literal: true
2
-
3
- ### V1/CONTENT ###
4
-
5
- require_relative './assets'
6
-
7
- module PublicContent
8
- include PublicAssets
9
- end
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
@@ -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/pub.rb CHANGED
@@ -95,6 +95,7 @@ module Cxf
95
95
  api_key,
96
96
  'public',
97
97
  nil,
98
+ nil,
98
99
  contact_token_id,
99
100
  visit_id,
100
101
  debug,
@@ -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,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Docs
4
+ def generate_docs(data)
5
+ @client.raw('post', '/config/docs/generate', nil, data_transform(data))
6
+ end
7
+
8
+ def get_doc_jobs
9
+ @client.raw('get', '/config/docs/jobs')
10
+ end
11
+ 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
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Password
4
+ def update_password(type,data)
5
+ @client.raw('post', "/config/#{type}/password/update", nil, data_transform(data))
6
+ end
7
+ 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