cxf 0.0.1
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 +7 -0
- data/Gemfile +12 -0
- data/README.md +395 -0
- data/lib/client.rb +447 -0
- data/lib/contact/config/config.rb +4 -0
- data/lib/contact/content/content.rb +4 -0
- data/lib/contact/ecommerce/ecommerce.rb +4 -0
- data/lib/contact.rb +284 -0
- data/lib/cxf/controllers/admin_base_controller.rb +17 -0
- data/lib/cxf/controllers/base_api_controller.rb +28 -0
- data/lib/cxf/controllers/base_controller.rb +54 -0
- data/lib/cxf/controllers/concerns/cxf_clients.rb +104 -0
- data/lib/cxf/controllers/concerns/read_config_file.rb +30 -0
- data/lib/cxf/controllers/contact_api_controller.rb +17 -0
- data/lib/cxf/controllers/public_api_controller.rb +14 -0
- data/lib/cxf/controllers/user_api_controller.rb +16 -0
- data/lib/cxf/helpers/contact_auth_helper.rb +86 -0
- data/lib/cxf/helpers/cxf_helper.rb +52 -0
- data/lib/cxf/helpers/proxy_controllers_methods.rb +144 -0
- data/lib/cxf/helpers/threads_helper.rb +109 -0
- data/lib/cxf/helpers/user_auth_helper.rb +74 -0
- data/lib/cxf.rb +15 -0
- data/lib/errors.rb +109 -0
- data/lib/generators/cxf_assets_controller.rb +7 -0
- data/lib/generators/cxf_config.yml.erb +27 -0
- data/lib/generators/cxf_contact_controller.rb +7 -0
- data/lib/generators/cxf_files_generator.rb +28 -0
- data/lib/generators/cxf_public_controller.rb +7 -0
- data/lib/generators/cxf_user_controller.rb +7 -0
- data/lib/pub/config/config.rb +6 -0
- data/lib/pub/content/assets.rb +16 -0
- data/lib/pub/content/content.rb +9 -0
- data/lib/pub/ecommerce/ecommerce.rb +6 -0
- data/lib/pub.rb +163 -0
- data/lib/user/config/attribute_groups.rb +79 -0
- data/lib/user/config/attributes.rb +88 -0
- data/lib/user/config/calendars.rb +91 -0
- data/lib/user/config/config.rb +23 -0
- data/lib/user/config/relationships.rb +141 -0
- data/lib/user/config/seeds.rb +55 -0
- data/lib/user/config/system_settings.rb +54 -0
- data/lib/user/config/tags.rb +61 -0
- data/lib/user/config/taxonomies.rb +120 -0
- data/lib/user/config/users.rb +77 -0
- data/lib/user/config/views.rb +68 -0
- data/lib/user/contacts/contacts.rb +22 -0
- data/lib/user/content/assets.rb +294 -0
- data/lib/user/content/block_templates.rb +72 -0
- data/lib/user/content/blocks.rb +109 -0
- data/lib/user/content/content.rb +174 -0
- data/lib/user/content/instances.rb +121 -0
- data/lib/user/content/print_versions.rb +129 -0
- data/lib/user/content/stories.rb +110 -0
- data/lib/user/content/story_templates.rb +97 -0
- data/lib/user/content/templates.rb +72 -0
- data/lib/user/crm/companies.rb +111 -0
- data/lib/user/crm/contacts.rb +294 -0
- data/lib/user/crm/crm.rb +9 -0
- data/lib/user/ecommerce/ecommerce.rb +29 -0
- data/lib/user/ecommerce/item_prices.rb +89 -0
- data/lib/user/ecommerce/locations.rb +171 -0
- data/lib/user/ecommerce/price_lists.rb +75 -0
- data/lib/user/ecommerce/product_templates.rb +106 -0
- data/lib/user/ecommerce/product_variations.rb +133 -0
- data/lib/user/ecommerce/product_versions.rb +107 -0
- data/lib/user/ecommerce/products.rb +156 -0
- data/lib/user/ecommerce/skus.rb +90 -0
- data/lib/user/ecommerce/taxes.rb +84 -0
- data/lib/user/ecommerce/variant_options.rb +71 -0
- data/lib/user/ecommerce/variant_values.rb +74 -0
- data/lib/user/ecommerce/vouchers.rb +90 -0
- data/lib/user/helpers/helpers.rb +116 -0
- data/lib/user/helpers/object_activities.rb +85 -0
- data/lib/user/helpers/object_folders.rb +84 -0
- data/lib/user/helpers/user_folders.rb +85 -0
- data/lib/user/marketing/marketing.rb +123 -0
- data/lib/user/profile/profile.rb +104 -0
- data/lib/user.rb +98 -0
- metadata +227 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tags
|
4
|
+
##
|
5
|
+
# == Tags
|
6
|
+
#
|
7
|
+
# === Get tags.
|
8
|
+
# Get a collection of tags.
|
9
|
+
#
|
10
|
+
# ==== Example
|
11
|
+
# @data = @cxf_user.get_tags
|
12
|
+
def get_tags
|
13
|
+
@client.raw('get', '/config/tags')
|
14
|
+
end
|
15
|
+
|
16
|
+
# === Get tag.
|
17
|
+
# Get a tag info.
|
18
|
+
#
|
19
|
+
# ==== Parameters
|
20
|
+
# id:: (Integer) -- Tag id.
|
21
|
+
#
|
22
|
+
# ==== Example
|
23
|
+
# @data = @cxf_user.get_tag(1)
|
24
|
+
def get_tag(id)
|
25
|
+
@client.raw('get', "/config/tags/#{id}")
|
26
|
+
end
|
27
|
+
|
28
|
+
# === Create tag.
|
29
|
+
# Create a tag with data.
|
30
|
+
#
|
31
|
+
# ==== Parameters
|
32
|
+
# data:: (Hash) -- Data to be submitted.
|
33
|
+
#
|
34
|
+
# ==== Example
|
35
|
+
# data = {
|
36
|
+
# tag: 'new-tag',
|
37
|
+
# is_visible: true
|
38
|
+
# }
|
39
|
+
# @data = @cxf_user.create_tag(data)
|
40
|
+
def create_tag(data)
|
41
|
+
@client.raw('post', '/config/tags', nil, data_transform(data))
|
42
|
+
end
|
43
|
+
|
44
|
+
# === Update tag.
|
45
|
+
# Update a tag info.
|
46
|
+
#
|
47
|
+
# ==== Parameters
|
48
|
+
# id:: (Integer) -- Tag id.
|
49
|
+
# data:: (Hash) -- Data to be submitted.
|
50
|
+
#
|
51
|
+
# ==== Example
|
52
|
+
# data = {
|
53
|
+
# tag: 'new-tag',
|
54
|
+
# slug: 'new-tag',
|
55
|
+
# is_visible: false
|
56
|
+
# }
|
57
|
+
# @data = @cxf_user.update_tag(54, data)
|
58
|
+
def update_tag(id, data)
|
59
|
+
@client.raw('put', "/config/tags/#{id}", nil, data_transform(data))
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Taxonomies
|
4
|
+
##
|
5
|
+
# == Taxonomies
|
6
|
+
#
|
7
|
+
# === Sync taxonomies for object.
|
8
|
+
# Sync taxonomies for object.
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# data:: (Hash) -- Data to be submitted.
|
12
|
+
#
|
13
|
+
# ==== Example
|
14
|
+
# data = {
|
15
|
+
# object_type: 'contacts',
|
16
|
+
# object_id: 1
|
17
|
+
# }
|
18
|
+
# @data = @cxf_user.sync_taxonomies_for_object(data)
|
19
|
+
def sync_taxonomies_for_object(data)
|
20
|
+
@client.raw('put', '/config/taxonomies/sync_taxonomies_for_object', nil, data_transform(data))
|
21
|
+
end
|
22
|
+
|
23
|
+
# === Get taxonomies for object.
|
24
|
+
# Get taxonomies for object.
|
25
|
+
#
|
26
|
+
# ==== Parameters
|
27
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
28
|
+
#
|
29
|
+
# ==== Example
|
30
|
+
# options = {
|
31
|
+
# object_type: "contacts",
|
32
|
+
# object_id: 1
|
33
|
+
# }
|
34
|
+
# @data = @cxf_user.get_taxonomies_for_object(options)
|
35
|
+
def get_taxonomies_for_object(options)
|
36
|
+
@client.raw('get', '/config/taxonomies/get_taxonomies_for_object', options)
|
37
|
+
end
|
38
|
+
|
39
|
+
# === Get taxonomies support data.
|
40
|
+
# Get support data used in taxonomies.
|
41
|
+
#
|
42
|
+
# ==== Example
|
43
|
+
# @data = @cxf_user.get_taxonomies_support_data
|
44
|
+
def get_taxonomies_support_data
|
45
|
+
@client.raw('get', '/config/taxonomies/support-data')
|
46
|
+
end
|
47
|
+
|
48
|
+
# === Get taxonomies.
|
49
|
+
# Get a collection of taxonomies.
|
50
|
+
#
|
51
|
+
# ==== Parameters
|
52
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
53
|
+
# use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
|
54
|
+
#
|
55
|
+
# ==== First Example
|
56
|
+
# @data = @cxf_user.get_taxonomies
|
57
|
+
#
|
58
|
+
# ==== Second Example
|
59
|
+
# options = { fields: 'title' }
|
60
|
+
# @data = @cxf_user.get_taxonomies(options)
|
61
|
+
#
|
62
|
+
# ==== Third Example
|
63
|
+
# options = { fields: 'title' }
|
64
|
+
# @data = @cxf_user.get_taxonomies(options, false)
|
65
|
+
def get_taxonomies(options = nil, use_post = true)
|
66
|
+
get_query_results('/config/taxonomies', options, use_post)
|
67
|
+
end
|
68
|
+
|
69
|
+
# === Get taxonomy.
|
70
|
+
# Get a taxonomy info.
|
71
|
+
#
|
72
|
+
# ==== Parameters
|
73
|
+
# id:: (Integer) -- Taxonomy id.
|
74
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
75
|
+
#
|
76
|
+
# ==== First Example
|
77
|
+
# @data = @cxf_user.get_taxonomy(1)
|
78
|
+
#
|
79
|
+
# ==== Second Example
|
80
|
+
# options = { fields: 'title' }
|
81
|
+
# @data = @cxf_user.get_taxonomy(1, options)
|
82
|
+
def get_taxonomy(id, options = nil)
|
83
|
+
@client.raw('get', "/config/taxonomies/#{id}", options)
|
84
|
+
end
|
85
|
+
|
86
|
+
# === Create taxonomy.
|
87
|
+
# Create a taxonomy with data.
|
88
|
+
#
|
89
|
+
# ==== Parameters
|
90
|
+
# data:: (Hash) -- Data to be submitted.
|
91
|
+
#
|
92
|
+
# ==== Example
|
93
|
+
# data = {
|
94
|
+
# title: 'New Taxonomy',
|
95
|
+
# slug: 'new-taxonomy',
|
96
|
+
# object_type: 'contacts'
|
97
|
+
# }
|
98
|
+
# @data = @cxf_user.create_taxonomy(data)
|
99
|
+
def create_taxonomy(data, options = nil)
|
100
|
+
@client.raw('post', '/config/taxonomies', options, data_transform(data))
|
101
|
+
end
|
102
|
+
|
103
|
+
# === Update taxonomy.
|
104
|
+
# Update a taxonomy info.
|
105
|
+
#
|
106
|
+
# ==== Parameters
|
107
|
+
# id:: (Integer) -- Taxonomy id.
|
108
|
+
# data:: (Hash) -- Data to be submitted.
|
109
|
+
#
|
110
|
+
# ==== Example
|
111
|
+
# data = {
|
112
|
+
# title: "New Taxonomy Modified",
|
113
|
+
# slug: "new-taxonomy",
|
114
|
+
# object_type: "contacts"
|
115
|
+
# }
|
116
|
+
# @data = @cxf_user.update_taxonomy(104, data)
|
117
|
+
def update_taxonomy(id, data, options = nil)
|
118
|
+
@client.raw('put', "/config/taxonomies/#{id}", options, data_transform(data))
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Users
|
4
|
+
##
|
5
|
+
# == Users
|
6
|
+
#
|
7
|
+
##
|
8
|
+
# === Can Users Coach.
|
9
|
+
# Determine if users can coach.
|
10
|
+
#
|
11
|
+
# ==== Example
|
12
|
+
# @data = @cxf_user.can_users_coach
|
13
|
+
def can_users_coach
|
14
|
+
@client.raw('get', '/config/users/can_coach')
|
15
|
+
end
|
16
|
+
|
17
|
+
# === Get users.
|
18
|
+
# Get a collection of users.
|
19
|
+
#
|
20
|
+
# ==== Example
|
21
|
+
# @data = @cxf_user.get_users
|
22
|
+
def get_users(options)
|
23
|
+
@client.raw('get', '/config/users', options)
|
24
|
+
end
|
25
|
+
|
26
|
+
# === Get user.
|
27
|
+
# Get an user info.
|
28
|
+
#
|
29
|
+
# ==== Parameters
|
30
|
+
# id:: (Integer) -- User id.
|
31
|
+
#
|
32
|
+
# ==== Example
|
33
|
+
# @data = @cxf_user.get_user(8)
|
34
|
+
def get_user(id)
|
35
|
+
@client.raw('get', "/config/users/#{id}")
|
36
|
+
end
|
37
|
+
|
38
|
+
# === Create user.
|
39
|
+
# Create an user with data.
|
40
|
+
#
|
41
|
+
# ==== Parameters
|
42
|
+
# data:: (Hash) -- Data to be submitted.
|
43
|
+
#
|
44
|
+
# ==== Example
|
45
|
+
# data = {
|
46
|
+
# name: 'New User Name',
|
47
|
+
# email: 'new_user_email@example.com',
|
48
|
+
# is_confirmed: false,
|
49
|
+
# set_password: true,
|
50
|
+
# password: '123456',
|
51
|
+
# is_coach: false
|
52
|
+
# }
|
53
|
+
# @data = @cxf_user.create_user(data)
|
54
|
+
def create_user(data, options = nil)
|
55
|
+
@client.raw('post', '/config/users', options, data_transform(data))
|
56
|
+
end
|
57
|
+
|
58
|
+
# === Update user.
|
59
|
+
# Update an user info.
|
60
|
+
#
|
61
|
+
# ==== Parameters
|
62
|
+
# id:: (Integer) -- User id.
|
63
|
+
# data:: (Hash) -- Data to be submitted.
|
64
|
+
#
|
65
|
+
# ==== Example
|
66
|
+
# data = {
|
67
|
+
# name: 'New User Name Modified',
|
68
|
+
# email: 'new_user_name@example.com',
|
69
|
+
# is_active: true,
|
70
|
+
# is_confirmed: false,
|
71
|
+
# roles: ''
|
72
|
+
# }
|
73
|
+
# @data = @cxf_user.update_user(14, data)
|
74
|
+
def update_user(id, data, options = nil)
|
75
|
+
@client.raw('put', "/config/users/#{id}", options, data_transform(data))
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Views
|
4
|
+
# === Get views.
|
5
|
+
# Get a collection of views.
|
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_views
|
12
|
+
#
|
13
|
+
# ==== Second Example
|
14
|
+
# options = { sort: 'id' }
|
15
|
+
# @data = @cxf_user.get_views(options)
|
16
|
+
def get_views(options = nil)
|
17
|
+
@client.raw('get', '/config/views', 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_view(id)
|
29
|
+
@client.raw('get', "/config/views/#{id}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# === Create export.
|
33
|
+
# Create an export with data.
|
34
|
+
#
|
35
|
+
# ==== Parameters
|
36
|
+
# data:: (Hash) -- Data to be submitted.
|
37
|
+
#
|
38
|
+
# ==== Example
|
39
|
+
# data = {
|
40
|
+
# title: 'New configuration',
|
41
|
+
# slug: 'new-configuration',
|
42
|
+
# object_model: 'Contact',
|
43
|
+
# config_json: {}
|
44
|
+
# }
|
45
|
+
# @data = @cxf_user.create_export(data)
|
46
|
+
def create_view(data)
|
47
|
+
@client.raw('post', '/config/views', nil, data_transform(data))
|
48
|
+
end
|
49
|
+
|
50
|
+
# === Update export configuration.
|
51
|
+
# Update an export configuration info.
|
52
|
+
#
|
53
|
+
# ==== Parameters
|
54
|
+
# id:: (Integer) -- Export configuration id.
|
55
|
+
# data:: (Hash) -- Data to be submitted.
|
56
|
+
#
|
57
|
+
# ==== Example
|
58
|
+
# data = {
|
59
|
+
# title: 'New configuration',
|
60
|
+
# slug: 'new-configuration',
|
61
|
+
# object_model: 'Contact',
|
62
|
+
# config_json: {}
|
63
|
+
# }
|
64
|
+
# @data = @cxf_user.update_export(36, data)
|
65
|
+
def update_view(id, data)
|
66
|
+
@client.raw('put', "/config/views/#{id}", nil, data_transform(data))
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Contacts
|
4
|
+
##
|
5
|
+
# == Contact Auth
|
6
|
+
#
|
7
|
+
# === Change password no auth.
|
8
|
+
# Change password to an email without auth.
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# data:: (Hash) -- Data to be submitted.
|
12
|
+
#
|
13
|
+
# ==== Example
|
14
|
+
# data = {
|
15
|
+
# password: '12345678',
|
16
|
+
# email: 'email@example.com'
|
17
|
+
# }
|
18
|
+
# @data = @cxf_user.change_password_no_auth(data)
|
19
|
+
def change_password_no_auth(data)
|
20
|
+
@client.raw('post', '/contacts/change-password-no-auth', nil, data_transform(data))
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,294 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Assets
|
4
|
+
##
|
5
|
+
# == Assets
|
6
|
+
#
|
7
|
+
# === Get assets.
|
8
|
+
# Get a collection of assets.
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
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_assets
|
16
|
+
#
|
17
|
+
# ==== Second Example
|
18
|
+
# options = { fields: 'id, title' }
|
19
|
+
# @data = @cxf_user.get_assets(options)
|
20
|
+
#
|
21
|
+
# ==== Third Example
|
22
|
+
# options = { fields: 'id, title' }
|
23
|
+
# @data = @cxf_user.get_assets(options, true)
|
24
|
+
def get_assets(options = nil, use_post = true)
|
25
|
+
get_query_results('/content/assets', options, use_post)
|
26
|
+
end
|
27
|
+
|
28
|
+
# === Get asset.
|
29
|
+
# Get a asset info.
|
30
|
+
#
|
31
|
+
# ==== Parameters
|
32
|
+
# id:: (Integer) -- Asset 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_asset(1)
|
37
|
+
#
|
38
|
+
# ==== Second Example
|
39
|
+
# options = {
|
40
|
+
# fields: 'id, title'
|
41
|
+
# }
|
42
|
+
# @data = @cxf_user.get_asset(1, options)
|
43
|
+
def get_asset(id, options = nil)
|
44
|
+
@client.raw('get', "/content/assets/#{id}", options)
|
45
|
+
end
|
46
|
+
|
47
|
+
# === Create asset.
|
48
|
+
# Create a asset with data.
|
49
|
+
#
|
50
|
+
# ==== Parameters
|
51
|
+
# data:: (Hash) -- Data to be submitted.
|
52
|
+
#
|
53
|
+
# ==== Example
|
54
|
+
# data = {
|
55
|
+
# title: 'New Asset',
|
56
|
+
# slug: 'new-asset',
|
57
|
+
# }
|
58
|
+
# @data = @cxf_user.create_asset(data)
|
59
|
+
def create_asset(data)
|
60
|
+
@client.raw('post', '/content/assets', nil, data_transform(data))
|
61
|
+
end
|
62
|
+
|
63
|
+
# === Update asset.
|
64
|
+
# Update a asset info.
|
65
|
+
#
|
66
|
+
# ==== Parameters
|
67
|
+
# id:: (Integer) -- Asset id.
|
68
|
+
# data:: (Hash) -- Data to be submitted.
|
69
|
+
#
|
70
|
+
# ==== Example
|
71
|
+
# data = {
|
72
|
+
# title: 'New Asset Modified',
|
73
|
+
# slug: 'new-asset'
|
74
|
+
# }
|
75
|
+
# @data = @cxf_user.update_asset(5, data)
|
76
|
+
def update_asset(id, data)
|
77
|
+
@client.raw('put', "/content/assets/#{id}", nil, data_transform(data))
|
78
|
+
end
|
79
|
+
|
80
|
+
# === Delete asset.
|
81
|
+
# Delete a asset.
|
82
|
+
#
|
83
|
+
# ==== Parameters
|
84
|
+
# id:: (Integer) -- Asset id.
|
85
|
+
#
|
86
|
+
# ==== Example
|
87
|
+
# @data = @cxf_user.delete_asset(6)
|
88
|
+
def delete_asset(id)
|
89
|
+
@client.raw('delete', "/content/assets/#{id}")
|
90
|
+
end
|
91
|
+
|
92
|
+
# === Get asset link info.
|
93
|
+
# Get information of an asset by url.
|
94
|
+
#
|
95
|
+
# ==== Parameters
|
96
|
+
# data:: (Hash) -- Data to be submitted.
|
97
|
+
#
|
98
|
+
# ==== Example
|
99
|
+
# data = {
|
100
|
+
# link: 'https://www.example.com/img/img.jpg'
|
101
|
+
# }
|
102
|
+
# @data = @cxf_user.get_asset_link_info(data.to_json)
|
103
|
+
def get_asset_link_info(data)
|
104
|
+
@client.raw('post', '/content/assets/getLinkInfo', nil, data)
|
105
|
+
end
|
106
|
+
|
107
|
+
# === Download asset.
|
108
|
+
# Get information of an asset.
|
109
|
+
#
|
110
|
+
# ==== Parameters
|
111
|
+
# id:: (Integer) -- Asset id.
|
112
|
+
#
|
113
|
+
# ==== Example
|
114
|
+
# @data = @cxf_user.download_asset(2)
|
115
|
+
def download_asset(id)
|
116
|
+
# FIXME: File not found at path, error in result but method works
|
117
|
+
@client.raw('get', "/content/assets/download/#{id}")
|
118
|
+
end
|
119
|
+
|
120
|
+
def get_asset_thumbnails(id)
|
121
|
+
# FIXME: Returns json invalid token
|
122
|
+
@client.raw('get', "/content/assets/thumbnails/#{id}")
|
123
|
+
end
|
124
|
+
|
125
|
+
# === Get asset usage.
|
126
|
+
# Get usage of an asset.
|
127
|
+
#
|
128
|
+
# ==== Parameters
|
129
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
130
|
+
def get_asset_usage(options)
|
131
|
+
@client.raw('get', '/content/assets/usage', options)
|
132
|
+
end
|
133
|
+
|
134
|
+
# === Get asset info.
|
135
|
+
# Get info of an asset.
|
136
|
+
# TODO: Research if is an asset or many assets
|
137
|
+
#
|
138
|
+
# ==== Parameters
|
139
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
140
|
+
def get_asset_info(options)
|
141
|
+
@client.raw('get', '/content/assets/getAssetInfo', options)
|
142
|
+
end
|
143
|
+
|
144
|
+
# === Get asset doc types.
|
145
|
+
# Get doc types of assets.
|
146
|
+
def get_asset_doc_types
|
147
|
+
@client.raw('get', '/content/assets/docTypes')
|
148
|
+
end
|
149
|
+
|
150
|
+
# === Get asset public route.
|
151
|
+
# Get public route of assets.
|
152
|
+
def get_asset_public_route
|
153
|
+
@client.raw('get', '/content/assets/publicRoute')
|
154
|
+
end
|
155
|
+
|
156
|
+
# === Upload asset.
|
157
|
+
# Upload an asset. It can be images, documents and videos.
|
158
|
+
#
|
159
|
+
# ==== Parameters
|
160
|
+
# data:: (Hash) -- Data to be submitted.
|
161
|
+
#
|
162
|
+
# ==== First Example (with files)
|
163
|
+
#
|
164
|
+
#
|
165
|
+
# ==== Second Example (with urls)
|
166
|
+
# data = {
|
167
|
+
# title: 'asset title',
|
168
|
+
# description: 'asset description',
|
169
|
+
# link: 'https://link/example',
|
170
|
+
# url-type: 'url-image',
|
171
|
+
# slug: 'slug',
|
172
|
+
# type: 'link',
|
173
|
+
# father_id: 1
|
174
|
+
# }
|
175
|
+
# @data = @cxf_user.upload_asset(data.to_json)
|
176
|
+
#
|
177
|
+
# ==== Third Example (with video)
|
178
|
+
# data = {
|
179
|
+
# title: 'Video Title',
|
180
|
+
# fileType: 'video/mp4',
|
181
|
+
# type: 'video',
|
182
|
+
# slug: 'video-slug',
|
183
|
+
# status: 'not-uploaded',
|
184
|
+
# ext: 'mp4',
|
185
|
+
# size: 29605264,
|
186
|
+
# access_token: 'access_token',
|
187
|
+
# name: 'Video Title',
|
188
|
+
# videoData: {
|
189
|
+
# id: 80313307,
|
190
|
+
# name: 'Video Title',
|
191
|
+
# type: 'video',
|
192
|
+
# created: '2021-10-19T19:18:17+00:00',
|
193
|
+
# updated: '2021-10-19T19:18:17+00:00',
|
194
|
+
# duration: 191.936133,
|
195
|
+
# hashed_id: 'hashed_id',
|
196
|
+
# progress: 0.14285714285714285,
|
197
|
+
# status: 'queued',
|
198
|
+
# thumbnail: {
|
199
|
+
# url: 'https://www.example.com/img/img.jpg',
|
200
|
+
# width: 200,
|
201
|
+
# height: 120
|
202
|
+
# },
|
203
|
+
# account_id: 1234567
|
204
|
+
# }
|
205
|
+
# }
|
206
|
+
# @data = @cxf_user.upload_asset(data.to_json)
|
207
|
+
def upload_asset(data)
|
208
|
+
# TODO: Research a way to upload a File across sdk
|
209
|
+
@client.raw('post', '/content/assets/upload', nil, data)
|
210
|
+
end
|
211
|
+
|
212
|
+
##
|
213
|
+
# == Sizes
|
214
|
+
#
|
215
|
+
# === Get asset sizes.
|
216
|
+
# Get a collection of sizes of an asset.
|
217
|
+
#
|
218
|
+
# ==== Parameters
|
219
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
220
|
+
# FIXME: Double get asset sizes method!
|
221
|
+
def get_asset_sizes(options)
|
222
|
+
@client.raw('get', '/content/assets/sizes', options)
|
223
|
+
end
|
224
|
+
|
225
|
+
# === Get asset sizes.
|
226
|
+
# Get sizes of an asset.
|
227
|
+
#
|
228
|
+
# ==== Parameters
|
229
|
+
# id:: (Integer) Asset id.
|
230
|
+
#
|
231
|
+
# ==== Example
|
232
|
+
# @data = @cxf_user.get_asset_sizes(2)
|
233
|
+
def get_asset_size(id)
|
234
|
+
# FIXME: wrong number of arguments (given 1, expected 0)
|
235
|
+
@client.raw('get', "/content/assets/sizes/#{id}")
|
236
|
+
end
|
237
|
+
|
238
|
+
# === Create asset size.
|
239
|
+
# Create an asset size by data.
|
240
|
+
#
|
241
|
+
# ==== Parameters
|
242
|
+
# data:: (Hash) -- Data to be submitted.
|
243
|
+
#
|
244
|
+
# ==== Example
|
245
|
+
# data = {
|
246
|
+
# aspectRadio: 'custom',
|
247
|
+
# assetId: 23,
|
248
|
+
# drawPosData: {
|
249
|
+
# pos: {
|
250
|
+
# sx: 100,
|
251
|
+
# sy: 100,
|
252
|
+
# swidth: 200,
|
253
|
+
# sheight: 200
|
254
|
+
# }
|
255
|
+
# },
|
256
|
+
# width: 100,
|
257
|
+
# height: 100,
|
258
|
+
# slug: 'fuji_size_slug',
|
259
|
+
# title: 'fuji_size',
|
260
|
+
# variationId: 'original'
|
261
|
+
# }
|
262
|
+
# @data = @cxf_user.create_asset_size(data.to_json)
|
263
|
+
def create_asset_size(data)
|
264
|
+
@client.raw('post', '/content/assets/sizes', nil, data)
|
265
|
+
end
|
266
|
+
|
267
|
+
##
|
268
|
+
# == Variations
|
269
|
+
#
|
270
|
+
# === Get asset variation.
|
271
|
+
# Get variation of an asset.
|
272
|
+
#
|
273
|
+
# ==== Parameters
|
274
|
+
# id:: (Integer) Asset variation id.
|
275
|
+
#
|
276
|
+
# ==== Example
|
277
|
+
# @data = @cxf_user.get_asset_sizes(2)
|
278
|
+
# TODO: Research if is an asset id or an variation id
|
279
|
+
def get_asset_variation(id)
|
280
|
+
# FIXME: Id 1 and 4: Trying to get property 'path' of non-object maybe json conversion is bad
|
281
|
+
# FIXME: Id 2 and 3: File not found at path maybe doesnt exist
|
282
|
+
@client.raw('get', "/content/assets/variation/#{id}")
|
283
|
+
end
|
284
|
+
|
285
|
+
# === Generate asset variation.
|
286
|
+
# Create an asset variation of an existing asset.
|
287
|
+
#
|
288
|
+
# ==== Parameters
|
289
|
+
# data:: (Hash) -- Data to be submitted.
|
290
|
+
def generate_asset_variation(data)
|
291
|
+
# FIXME: Trying to get property 'width' of non-object
|
292
|
+
@client.raw('post', '/content/assets/generate-asset-variations', nil, data)
|
293
|
+
end
|
294
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BlockTemplates
|
4
|
+
# === Get block templates.
|
5
|
+
# Get a collection of block templates.
|
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_block_templates
|
12
|
+
#
|
13
|
+
# ==== Second Example
|
14
|
+
# options = {
|
15
|
+
# fields: 'id, title'
|
16
|
+
# }
|
17
|
+
# @data = @cxf_user.get_block_templates(options)
|
18
|
+
def get_block_templates(options = nil)
|
19
|
+
@client.raw('get', '/content/block-templates', options)
|
20
|
+
end
|
21
|
+
|
22
|
+
# === Get block template.
|
23
|
+
# Get a block template info.
|
24
|
+
#
|
25
|
+
# ==== Parameters
|
26
|
+
# id:: (Integer) -- block template id.
|
27
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
28
|
+
#
|
29
|
+
# ==== First Example
|
30
|
+
# @data = @cxf_user.get_block_template(2)
|
31
|
+
#
|
32
|
+
# ==== Second Example
|
33
|
+
# options = {
|
34
|
+
# fields: 'title'
|
35
|
+
# }
|
36
|
+
# @data = @cxf_user.get_block_template(1, options)
|
37
|
+
def get_block_template(id, options = nil)
|
38
|
+
@client.raw('get', "/content/block-templates/#{id}", options)
|
39
|
+
end
|
40
|
+
|
41
|
+
# === Create block template.
|
42
|
+
# Create a block template with data.
|
43
|
+
#
|
44
|
+
# ==== Parameters
|
45
|
+
# data:: (Hash) -- Data to be submitted.
|
46
|
+
#
|
47
|
+
# ==== Example
|
48
|
+
# data = {
|
49
|
+
# title: 'New block Template',
|
50
|
+
# slug: 'new-block-template-slug'
|
51
|
+
# }
|
52
|
+
# @data = @cxf_user.create_block_template(data)
|
53
|
+
def create_block_template(data, options = nil)
|
54
|
+
@client.raw('post', '/content/block-templates', options, data_transform(data))
|
55
|
+
end
|
56
|
+
|
57
|
+
# === Update block template.
|
58
|
+
# Update a block template info.
|
59
|
+
#
|
60
|
+
# ==== Parameters
|
61
|
+
# id:: (Integer) -- block template id.
|
62
|
+
# data:: (Hash) -- Data to be submitted.
|
63
|
+
#
|
64
|
+
# ==== Example
|
65
|
+
# data = {
|
66
|
+
# title: 'New block Template Modified'
|
67
|
+
# }
|
68
|
+
# @data = @cxf_user.update_block_template(3, data)
|
69
|
+
def update_block_template(id, data)
|
70
|
+
@client.raw('put', "/content/block-templates/#{id}", nil, data_transform(data))
|
71
|
+
end
|
72
|
+
end
|