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
data/lib/pub.rb
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require_relative './client'
|
5
|
+
require_relative './cxf/helpers/cxf_helper'
|
6
|
+
require_relative './cxf/helpers/threads_helper'
|
7
|
+
require_relative './pub/content/content'
|
8
|
+
require_relative './pub/ecommerce/ecommerce'
|
9
|
+
require_relative './pub/config/config'
|
10
|
+
|
11
|
+
module Cxf
|
12
|
+
##
|
13
|
+
# == Public context API
|
14
|
+
# Pub class contains functions that needs only an API key as authentication
|
15
|
+
# == Usage example
|
16
|
+
# === For Cxf::BaseController inheritance:
|
17
|
+
# If the controller is inheriting from Cxf::BaseController, Only use the class variable *cxf_pub* _Example:_
|
18
|
+
# @cxf_pub.get_stories
|
19
|
+
# === For standalone usage:
|
20
|
+
# Initialize
|
21
|
+
# pub = Cxf::Pub.new(cxf_url, api_key)
|
22
|
+
# or if host and api_key are provided by cxf_config.yml.erb
|
23
|
+
# pub = Cxf::Pub.new
|
24
|
+
# Call any function
|
25
|
+
# pub.get_products
|
26
|
+
# == Single resource options
|
27
|
+
# * +include+ - [_String_] Specify additional information to be included in the results from the objects relations. _Example:_
|
28
|
+
# { "include": "events" }
|
29
|
+
# * +attributes+ - [_Boolean_] If present, attributes will be returned for each record in the results. _Example:_
|
30
|
+
# { "attributes": true }
|
31
|
+
# * +taxonomies+ - [_Boolean_] If present, taxonomies will be returned for each record in the results. _Example:_
|
32
|
+
# { "taxonomies": true }
|
33
|
+
# * +tags+ - [_Boolean_] If present, tags will be returned for each record in the results. _Example:_
|
34
|
+
# { "tags": true }
|
35
|
+
# * +fields+ - [_String_] Specify the fields that you want to be returned. If empty, all fields are returned. The object index can also be used to specify specific fields from relations. _Example:_
|
36
|
+
# { fields: "id, title, slug" }
|
37
|
+
# { "fields[products]": "id, title, slug" }
|
38
|
+
#
|
39
|
+
# == Resource collections options
|
40
|
+
# * +search+ - [_String_] If present, it will search for records matching the search string. _Example:_
|
41
|
+
# { "search": "search string" }
|
42
|
+
# * +scopes+ - [_String_] If present, it will apply the specified Model's scopes. _Example:_
|
43
|
+
# { "scopes": "approved, recent" }
|
44
|
+
# * +filters+ - [_String_] This is a powerful parameter that allows the data to be filtered by any of its fields. Currently only exact matches are supported. _Example:_
|
45
|
+
# { "filters[title]": "titleToFilter" }
|
46
|
+
# * +jfilters+ - [_String_] A complex filter configuration, as used in segments, in JSON format, base64 encoded and URLencoded. _Example:_
|
47
|
+
# jfilter = {
|
48
|
+
# "type":"group",
|
49
|
+
# "items":[
|
50
|
+
# {
|
51
|
+
# "type":"attribute",
|
52
|
+
# "operator":"==",
|
53
|
+
# slug:"title",
|
54
|
+
# "value":"Action movies"
|
55
|
+
# }
|
56
|
+
# ],
|
57
|
+
# "operator":"or"
|
58
|
+
# }
|
59
|
+
# options = { "jfilters": jfilter }
|
60
|
+
# * +sort+ - [_String_] The name of the field to perform the sort. Prefix the value with a minus sign - for ascending order. _Example:_
|
61
|
+
# { sort: "title" }
|
62
|
+
# { sort: "-title" }
|
63
|
+
|
64
|
+
class Pub
|
65
|
+
attr_reader :client
|
66
|
+
|
67
|
+
include CxfHelper
|
68
|
+
include PublicContent
|
69
|
+
include PublicEcommerce
|
70
|
+
include PublicConfig
|
71
|
+
include ThreadsHelper
|
72
|
+
|
73
|
+
##
|
74
|
+
# === Initialize.
|
75
|
+
# Class constructor.
|
76
|
+
#
|
77
|
+
# ==== Parameters
|
78
|
+
# host:: (String) -- It's the visitor IP.
|
79
|
+
# api_key:: (String) -- Cxf instance api key.
|
80
|
+
# contact_token_id:: (Integer) -- Cookie 'cxf_contact_id' value (cxf_contact_token).
|
81
|
+
#
|
82
|
+
# ==== Return
|
83
|
+
# Returns a Client object.
|
84
|
+
def initialize(
|
85
|
+
host,
|
86
|
+
api_key,
|
87
|
+
contact_token_id = nil,
|
88
|
+
visit_id = nil,
|
89
|
+
debug = false,
|
90
|
+
timeouts = {}
|
91
|
+
)
|
92
|
+
@client = Cxf::Client.new(
|
93
|
+
host,
|
94
|
+
api_key,
|
95
|
+
'public',
|
96
|
+
nil,
|
97
|
+
contact_token_id,
|
98
|
+
visit_id,
|
99
|
+
debug,
|
100
|
+
timeouts
|
101
|
+
)
|
102
|
+
end
|
103
|
+
|
104
|
+
##
|
105
|
+
# === Register Visit.
|
106
|
+
# Register a ghost/contact visit in Cxf.Cloud.
|
107
|
+
#
|
108
|
+
# ==== Parameters
|
109
|
+
# request:: (ActionDispatch::Request) -- request.
|
110
|
+
# ip:: (String) -- It's the visitor IP.
|
111
|
+
# user_agent:: (String) -- The visitor's browser user agent.
|
112
|
+
# url:: (String) -- URL visited.
|
113
|
+
#
|
114
|
+
# ==== Example
|
115
|
+
# request = {
|
116
|
+
# "remote_ip" => "http://1.1.1.1/",
|
117
|
+
# "user_agent" => "User Agent",
|
118
|
+
# "fullpath" => "https://fullpath/example"
|
119
|
+
# }
|
120
|
+
# @data = @cxf_pub.register_visit(request, request["remote_ip"], request["user_agent"], request["fullpath"])
|
121
|
+
def register_visit(request, ip = nil, user_agent = nil, url = nil)
|
122
|
+
data = {
|
123
|
+
ip_address: ip || request.remote_ip,
|
124
|
+
user_agent: user_agent || request.user_agent,
|
125
|
+
url: url || request.fullpath
|
126
|
+
}
|
127
|
+
|
128
|
+
@client.raw('post', '/register-visit', nil, data.to_json)
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# === Register Visit timer.
|
133
|
+
# Register a page visit time.
|
134
|
+
#
|
135
|
+
# ==== Parameters
|
136
|
+
# visit:: (String) -- It's the visitor IP.
|
137
|
+
# time:: (Integer) -- The visitor's browser user agent.
|
138
|
+
#
|
139
|
+
# ==== Example
|
140
|
+
# @data = @cxf_pub.register_visit_timer("60da2325d29acc7e55684472", 4)
|
141
|
+
def register_visit_timer(visit, time)
|
142
|
+
@client.raw('get', "/register-visit-timer?visit=#{visit}&time=#{time}")
|
143
|
+
end
|
144
|
+
|
145
|
+
def send_user_magic_link(email_or_phone, template_slug, redirect_url = '', life_time = 1440, max_visits = nil, driver = 'email')
|
146
|
+
data = {
|
147
|
+
driver: driver,
|
148
|
+
lifeTime: life_time,
|
149
|
+
maxVisits: max_visits,
|
150
|
+
redirectUrl: redirect_url,
|
151
|
+
templateId: template_slug
|
152
|
+
}
|
153
|
+
|
154
|
+
key = %w[sms whatsapp].include? driver ? 'phone' : 'email'
|
155
|
+
data[key] = email_or_phone
|
156
|
+
@client.raw('post', '/users/magic-link', nil, { data: data }.to_json, '/api/v1')
|
157
|
+
end
|
158
|
+
|
159
|
+
def get_client
|
160
|
+
@client
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AttributeGroups
|
4
|
+
##
|
5
|
+
# == Attribute Groups
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get attribute groups data types.
|
9
|
+
# Get data types used in attribute groups.
|
10
|
+
#
|
11
|
+
# ==== Example
|
12
|
+
# @data = @cxf_user.get_attribute_groups_data_types
|
13
|
+
def get_attribute_groups_data_types
|
14
|
+
@client.raw('get', '/config/attribute-groups/object-types')
|
15
|
+
end
|
16
|
+
|
17
|
+
# === Get attribute groups.
|
18
|
+
# Get a collection of attribute groups.
|
19
|
+
#
|
20
|
+
# ==== Parameters
|
21
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
22
|
+
#
|
23
|
+
# ==== First Example
|
24
|
+
# @data = @cxf_user.get_attribute_groups
|
25
|
+
#
|
26
|
+
# ==== Second Example
|
27
|
+
# options = { sort: 'id' }
|
28
|
+
# @data = @cxf_user.get_attribute_groups(options)
|
29
|
+
def get_attribute_groups(options = nil)
|
30
|
+
@client.raw('get', '/config/attribute-groups', options)
|
31
|
+
end
|
32
|
+
|
33
|
+
# === Get attribute group.
|
34
|
+
# Get an attribute group info.
|
35
|
+
#
|
36
|
+
# ==== Parameters
|
37
|
+
# id:: (Integer) -- Attribute group id.
|
38
|
+
#
|
39
|
+
# ==== Example
|
40
|
+
# @data = @cxf_user.get_attribute_group(10)
|
41
|
+
def get_attribute_group(id)
|
42
|
+
@client.raw('get', "/config/attribute-groups/#{id}")
|
43
|
+
end
|
44
|
+
|
45
|
+
# === Create attribute group.
|
46
|
+
# Create an attribute group with data.
|
47
|
+
#
|
48
|
+
# ==== Parameters
|
49
|
+
# data:: (Hash) -- Data to be submitted.
|
50
|
+
#
|
51
|
+
# ==== Example
|
52
|
+
# data = {
|
53
|
+
# title: 'New Attribute Group',
|
54
|
+
# object_type: 'contacts'
|
55
|
+
# }
|
56
|
+
# @data = @cxf_user.create_attribute_group(data)
|
57
|
+
def create_attribute_group(data)
|
58
|
+
@client.raw('post', '/config/attribute-groups', nil, data_transform(data))
|
59
|
+
end
|
60
|
+
|
61
|
+
# === Update attribute group.
|
62
|
+
# Update an attribute group info.
|
63
|
+
#
|
64
|
+
# ==== Parameters
|
65
|
+
# id:: (Integer) -- Attribute group id.
|
66
|
+
# data:: (Hash) -- Data to be submitted.
|
67
|
+
#
|
68
|
+
# ==== Example
|
69
|
+
# data = {
|
70
|
+
# title: 'New Attribute Group Modified',
|
71
|
+
# object_type: 'contacts',
|
72
|
+
# slug: 'new-attribute-group',
|
73
|
+
# description: 'New description'
|
74
|
+
# }
|
75
|
+
# @data = @cxf_user.update_attribute_group(36, data)
|
76
|
+
def update_attribute_group(id, data)
|
77
|
+
@client.raw('put', "/config/attribute-groups/#{id}", nil, data_transform(data))
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Attributes
|
4
|
+
##
|
5
|
+
# == Attributes
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get attributes data types.
|
9
|
+
# Get data types used in attributes.
|
10
|
+
#
|
11
|
+
# ==== Example
|
12
|
+
# @data = @cxf_user.get_attributes_data_types
|
13
|
+
def get_attributes_data_types
|
14
|
+
@client.raw('get', '/config/attributes/data-types')
|
15
|
+
end
|
16
|
+
|
17
|
+
# === Get sub attributes.
|
18
|
+
# Get sub attributes with a slug.
|
19
|
+
#
|
20
|
+
# ==== Parameters
|
21
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
22
|
+
#
|
23
|
+
# ==== Example
|
24
|
+
#
|
25
|
+
def get_sub_attributes(options)
|
26
|
+
@client.raw('get', '/config/attributes/sub-attributes', options)
|
27
|
+
end
|
28
|
+
|
29
|
+
# === Get attributes.
|
30
|
+
# Get a collection of attributes.
|
31
|
+
#
|
32
|
+
# ==== Example
|
33
|
+
# @data = @cxf_user.get_attributes
|
34
|
+
def get_attributes
|
35
|
+
@client.raw('get', '/config/attributes')
|
36
|
+
end
|
37
|
+
|
38
|
+
# === Get attribute.
|
39
|
+
# Get an attribute info.
|
40
|
+
#
|
41
|
+
# ==== Parameters
|
42
|
+
# id:: (Integer) -- Attribute id.
|
43
|
+
#
|
44
|
+
# ==== Example
|
45
|
+
# @data = @cxf_user.get_attribute(1)
|
46
|
+
def get_attribute(id)
|
47
|
+
@client.raw('get', "/config/attributes/#{id}")
|
48
|
+
end
|
49
|
+
|
50
|
+
# === Create attribute.
|
51
|
+
# Create an attribute with data.
|
52
|
+
#
|
53
|
+
# ==== Parameters
|
54
|
+
# data:: (Hash) -- Data to be submitted.
|
55
|
+
#
|
56
|
+
# ==== Example
|
57
|
+
# data = {
|
58
|
+
# title: "New Attribute",
|
59
|
+
# object_type: "orders",
|
60
|
+
# slug: "new_attribute",
|
61
|
+
# attribute_group_id: 1,
|
62
|
+
# data_type_enum: 10
|
63
|
+
# }
|
64
|
+
# @data = @cxf_user.create_attribute(data)
|
65
|
+
def create_attribute(data)
|
66
|
+
@client.raw('post', '/config/attributes', nil, data_transform(data))
|
67
|
+
end
|
68
|
+
|
69
|
+
# === Update attribute.
|
70
|
+
# Update an attribute info.
|
71
|
+
#
|
72
|
+
# ==== Parameters
|
73
|
+
# id:: (Integer) -- Attribute id.
|
74
|
+
# data:: (Hash) -- Data to be submitted.
|
75
|
+
#
|
76
|
+
# ==== Example
|
77
|
+
# data = {
|
78
|
+
# title: 'New Attribute Modified',
|
79
|
+
# object_type: 'orders',
|
80
|
+
# slug: 'new_attribute',
|
81
|
+
# attribute_group_id: 1,
|
82
|
+
# data_type_enum: 10
|
83
|
+
# }
|
84
|
+
# @data = @cxf_user.update_attribute(292, data)
|
85
|
+
def update_attribute(id, data)
|
86
|
+
@client.raw('put', "/config/attributes/#{id}", nil, data_transform(data))
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Calendars
|
4
|
+
##
|
5
|
+
# == Calendars
|
6
|
+
#
|
7
|
+
|
8
|
+
# === Get calendars.
|
9
|
+
# Get a collection of calendars.
|
10
|
+
#
|
11
|
+
# ==== Parameters
|
12
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
13
|
+
#
|
14
|
+
# ==== First Example
|
15
|
+
# @data = @cxf_user.get_calendars
|
16
|
+
#
|
17
|
+
# ==== Second Example
|
18
|
+
# options = {
|
19
|
+
# fields: 'title'
|
20
|
+
# }
|
21
|
+
# @data = @cxf_user.get_calendars(options)
|
22
|
+
def get_calendars(options = nil)
|
23
|
+
@client.raw('get', '/config/calendars', options)
|
24
|
+
end
|
25
|
+
|
26
|
+
# === Get calendar.
|
27
|
+
# Get a calendar info.
|
28
|
+
#
|
29
|
+
# ==== Parameters
|
30
|
+
# id:: (Integer) -- Calendar id.
|
31
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
32
|
+
#
|
33
|
+
# ==== First Example
|
34
|
+
# @data = @cxf_user.get_calendar(1)
|
35
|
+
#
|
36
|
+
# ==== Second Example
|
37
|
+
# options = {
|
38
|
+
# fields: 'title'
|
39
|
+
# }
|
40
|
+
# @data = @cxf_user.get_calendar(1, options)
|
41
|
+
def get_calendar(id, options = nil)
|
42
|
+
@client.raw('get', "/config/calendars/#{id}", options)
|
43
|
+
end
|
44
|
+
|
45
|
+
# === Create calendar.
|
46
|
+
# Create a calendar with data.
|
47
|
+
#
|
48
|
+
# ==== Parameters
|
49
|
+
# data:: (Hash) -- Data to be submitted.
|
50
|
+
#
|
51
|
+
# ==== Example
|
52
|
+
# data = {
|
53
|
+
# title: 'New Calendar',
|
54
|
+
# object_type: 'contacts',
|
55
|
+
# object_id: 1
|
56
|
+
# }
|
57
|
+
# @data = @cxf_user.create_calendar(data)
|
58
|
+
def create_calendar(data)
|
59
|
+
@client.raw('post', '/config/calendars', nil, data_transform(data))
|
60
|
+
end
|
61
|
+
|
62
|
+
# === Update calendar.
|
63
|
+
# Update a calendar info.
|
64
|
+
#
|
65
|
+
# ==== Parameters
|
66
|
+
# id:: (Integer) -- Calendar id.
|
67
|
+
# data:: (Hash) -- Data to be submitted.
|
68
|
+
#
|
69
|
+
# ==== Example
|
70
|
+
# data = {
|
71
|
+
# title: 'New Calendar Modified',
|
72
|
+
# object_type: 'contacts',
|
73
|
+
# object_id: 1
|
74
|
+
# }
|
75
|
+
# @data = @cxf_user.update_calendar(4, data)
|
76
|
+
def update_calendar(id, data)
|
77
|
+
@client.raw('put', "/config/calendars/#{id}", nil, data_transform(data))
|
78
|
+
end
|
79
|
+
|
80
|
+
# === Delete calendar.
|
81
|
+
# Delete a calendar.
|
82
|
+
#
|
83
|
+
# ==== Parameters
|
84
|
+
# id:: (Integer) -- Calendar id.
|
85
|
+
#
|
86
|
+
# ==== Example
|
87
|
+
# @data = @cxf_user.delete_calendar(4)
|
88
|
+
def delete_calendar(id)
|
89
|
+
@client.raw('delete', "/config/calendars/#{id}")
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative './attribute_groups'
|
4
|
+
require_relative './attributes'
|
5
|
+
require_relative './views'
|
6
|
+
require_relative './relationships'
|
7
|
+
require_relative './seeds'
|
8
|
+
require_relative './system_settings'
|
9
|
+
require_relative './tags'
|
10
|
+
require_relative './taxonomies'
|
11
|
+
require_relative './users'
|
12
|
+
|
13
|
+
module Config
|
14
|
+
include AttributeGroups
|
15
|
+
include Attributes
|
16
|
+
include Views
|
17
|
+
include Relationships
|
18
|
+
include Seeds
|
19
|
+
include SystemSettings
|
20
|
+
include Tags
|
21
|
+
include Taxonomies
|
22
|
+
include Users
|
23
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
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
|
+
# === Attach relationship.
|
23
|
+
# Attach a relationship.
|
24
|
+
#
|
25
|
+
# ==== Parameters
|
26
|
+
# data:: (Hash) -- Data to be submitted.
|
27
|
+
#
|
28
|
+
# ==== Example
|
29
|
+
#
|
30
|
+
def attach_relationship(data)
|
31
|
+
# FIXME: Method doesn't work, RelationshipManager cannot access to id attribute.
|
32
|
+
@client.raw('post', '/config/relationships/attach', nil, data_transform(data))
|
33
|
+
end
|
34
|
+
|
35
|
+
# === Detach relationship.
|
36
|
+
# Detach a relationship.
|
37
|
+
#
|
38
|
+
# ==== Parameters
|
39
|
+
# data:: (Hash) -- Data to be submitted.
|
40
|
+
#
|
41
|
+
# ==== Example
|
42
|
+
#
|
43
|
+
def detach_relationship(data)
|
44
|
+
# FIXME: Method doesn't work, RelationshipManager cannot access to id attribute.
|
45
|
+
@client.raw('post', '/config/relationships/detach', nil, data_transform(data))
|
46
|
+
end
|
47
|
+
|
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
|
+
|
60
|
+
# === Get relationships.
|
61
|
+
# Get a collection of relationships.
|
62
|
+
#
|
63
|
+
# ==== Parameters
|
64
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
65
|
+
#
|
66
|
+
# ==== First Example
|
67
|
+
# @data = @cxf_user.get_relationships
|
68
|
+
#
|
69
|
+
# ==== Second Example
|
70
|
+
# options = { fields: 'id' }
|
71
|
+
# @data = @cxf_user.get_relationships(options)
|
72
|
+
def get_relationships(options = nil)
|
73
|
+
@client.raw('get', '/config/relationships', options)
|
74
|
+
end
|
75
|
+
|
76
|
+
# === Get relationship.
|
77
|
+
# Get a relationship info.
|
78
|
+
#
|
79
|
+
# ==== Parameters
|
80
|
+
# id:: (Integer) -- Relationship id.
|
81
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
82
|
+
#
|
83
|
+
# ==== First Example
|
84
|
+
# @data = @cxf_user.get_relationship(1)
|
85
|
+
#
|
86
|
+
# ==== Second Example
|
87
|
+
# options = { fields: 'id' }
|
88
|
+
# @data = @cxf_user.get_relationship(1, options)
|
89
|
+
def get_relationship(id, options = nil)
|
90
|
+
@client.raw('get', "/config/relationships/#{id}", options)
|
91
|
+
end
|
92
|
+
|
93
|
+
# === Create relationship.
|
94
|
+
# Create a relationship with data.
|
95
|
+
#
|
96
|
+
# ==== Parameters
|
97
|
+
# data:: (Hash) -- Data to be submitted.
|
98
|
+
#
|
99
|
+
# ==== Example
|
100
|
+
# data = {
|
101
|
+
# alias_1: 'eventsCopy',
|
102
|
+
# alias_2: 'ticketsCopy',
|
103
|
+
# object_model_1: 'Story',
|
104
|
+
# object_model_2: 'Product'
|
105
|
+
# }
|
106
|
+
# @data = @cxf_user.create_relationship(data)
|
107
|
+
def create_relationship(data)
|
108
|
+
@client.raw('post', '/config/relationships', nil, data_transform(data))
|
109
|
+
end
|
110
|
+
|
111
|
+
# === Update relationship.
|
112
|
+
# Update a relationship info.
|
113
|
+
#
|
114
|
+
# ==== Parameters
|
115
|
+
# id:: (Integer) -- Relationship id.
|
116
|
+
# data:: (Hash) -- Data to be submitted.
|
117
|
+
#
|
118
|
+
# ==== Example
|
119
|
+
# data = {
|
120
|
+
# alias_1: 'eventsCopyModified',
|
121
|
+
# alias_2: 'ticketsCopyModified',
|
122
|
+
# object_model_1: 'Story',
|
123
|
+
# object_model_2: 'Product'
|
124
|
+
# }
|
125
|
+
# @data = @cxf_user.update_relationship(5, data)
|
126
|
+
def update_relationship(id, data)
|
127
|
+
@client.raw('put', "/config/relationships/#{id}", nil, data_transform(data))
|
128
|
+
end
|
129
|
+
|
130
|
+
# === Delete relationship.
|
131
|
+
# Delete a relationship.
|
132
|
+
#
|
133
|
+
# ==== Parameters
|
134
|
+
# id:: (Integer) -- Relationship id.
|
135
|
+
#
|
136
|
+
# ==== Example
|
137
|
+
# @data = @cxf_user.delete_relationship(5)
|
138
|
+
def delete_relationship(id)
|
139
|
+
@client.raw('delete', "/config/relationships/#{id}")
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Seeds
|
4
|
+
##
|
5
|
+
# == Seeds
|
6
|
+
#
|
7
|
+
# === Apply seeds.
|
8
|
+
# Apply seeds.
|
9
|
+
#
|
10
|
+
# ==== Example
|
11
|
+
#
|
12
|
+
def apply_seeds(data, async: false)
|
13
|
+
url = '/config/seeds'
|
14
|
+
url = "#{url}?async" if async
|
15
|
+
@client.raw('post', url, nil, data)
|
16
|
+
end
|
17
|
+
|
18
|
+
# === Get seed processes.
|
19
|
+
# Get a collection of seed processes.
|
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_seed_processes
|
27
|
+
#
|
28
|
+
# ==== Second Example
|
29
|
+
# options = {
|
30
|
+
# fields: 'id'
|
31
|
+
# }
|
32
|
+
# @data = @cxf_user.get_seed_processes(options)
|
33
|
+
def get_seed_processes(options = nil)
|
34
|
+
@client.raw('post', '/config/seed-processes', options)
|
35
|
+
end
|
36
|
+
|
37
|
+
# === Get seed process.
|
38
|
+
# Get a seed process info.
|
39
|
+
#
|
40
|
+
# ==== Parameters
|
41
|
+
# id:: (Integer) -- Seed process id.
|
42
|
+
# options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
|
43
|
+
#
|
44
|
+
# ==== First Example
|
45
|
+
# @data = @cxf_user.get_seed_process(1)
|
46
|
+
#
|
47
|
+
# ==== Second Example
|
48
|
+
# options = {
|
49
|
+
# fields: 'id, title'
|
50
|
+
# }
|
51
|
+
# @data = @cxf_user.get_seed_process(1, options)
|
52
|
+
def get_seed_process(id, options = nil)
|
53
|
+
@client.raw('get', "/config/seed-processes/#{id}", options)
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SystemSettings
|
4
|
+
##
|
5
|
+
# == System Settings
|
6
|
+
#
|
7
|
+
# === Get settings by keys.
|
8
|
+
# Get a collection of settings using keys.
|
9
|
+
#
|
10
|
+
# ==== Example
|
11
|
+
# options = {
|
12
|
+
# setting_keys: 'email_transport_provider,email_template_provider,email_template_default_from_address'
|
13
|
+
# }
|
14
|
+
# @data = @cxf_user.get_settings_by_keys(options)
|
15
|
+
def get_settings_by_keys(options)
|
16
|
+
@client.raw('get', '/config/settings/by-keys', options)
|
17
|
+
end
|
18
|
+
|
19
|
+
# === Get settings.
|
20
|
+
# Get a collection of settings.
|
21
|
+
#
|
22
|
+
# ==== Example
|
23
|
+
# @data = @cxf_user.get_settings
|
24
|
+
def get_settings
|
25
|
+
@client.raw('get', '/config/settings')
|
26
|
+
end
|
27
|
+
|
28
|
+
# === Create setting.
|
29
|
+
# Create a setting title with data.
|
30
|
+
#
|
31
|
+
# ==== Parameters
|
32
|
+
# data:: (Hash) -- Data to be submitted.
|
33
|
+
#
|
34
|
+
# ==== Example
|
35
|
+
# data = {
|
36
|
+
# title: 'new_settings'
|
37
|
+
# }
|
38
|
+
# @data = @cxf_user.create_setting(data)
|
39
|
+
def create_setting(data)
|
40
|
+
@client.raw('post', '/config/settings', nil, data_transform(data))
|
41
|
+
end
|
42
|
+
|
43
|
+
# === Clear tag.
|
44
|
+
# Clear a tag info.
|
45
|
+
#
|
46
|
+
# ==== Parameters
|
47
|
+
# tag:: (Integer) -- Tag id.
|
48
|
+
#
|
49
|
+
# ==== Example
|
50
|
+
# @data = @cxf_user.clear_tag(1)
|
51
|
+
def clear_tag(tag)
|
52
|
+
@client.raw('get', "/config/settings/tags/#{tag}/clear")
|
53
|
+
end
|
54
|
+
end
|