mints 0.0.26 → 0.0.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/lib/client.rb +75 -37
  4. data/lib/contact.rb +61 -62
  5. data/lib/errors.rb +98 -0
  6. data/lib/generators/mints_config.yml.erb +0 -2
  7. data/lib/generators/mints_link.rb +3 -3
  8. data/lib/mints/controllers/admin_base_controller.rb +8 -66
  9. data/lib/mints/controllers/base_api_controller.rb +16 -134
  10. data/lib/mints/controllers/base_controller.rb +20 -106
  11. data/lib/mints/controllers/concerns/mints_clients.rb +74 -0
  12. data/lib/mints/controllers/concerns/read_config_file.rb +28 -0
  13. data/lib/mints/controllers/contact_api_controller.rb +6 -85
  14. data/lib/mints/controllers/public_api_controller.rb +6 -79
  15. data/lib/mints/controllers/user_api_controller.rb +7 -82
  16. data/lib/mints/helpers/contact_auth_helper.rb +67 -0
  17. data/lib/{mints_helper.rb → mints/helpers/mints_helper.rb} +7 -5
  18. data/lib/mints/helpers/proxy_controllers_methods.rb +126 -0
  19. data/lib/mints/helpers/user_auth_helper.rb +53 -0
  20. data/lib/mints.rb +2 -0
  21. data/lib/pub.rb +56 -56
  22. data/lib/user/config/api_keys.rb +7 -7
  23. data/lib/user/config/appointments.rb +16 -16
  24. data/lib/user/config/attribute_groups.rb +10 -10
  25. data/lib/user/config/attributes.rb +10 -10
  26. data/lib/user/config/calendars.rb +9 -9
  27. data/lib/user/config/config.rb +7 -7
  28. data/lib/user/config/importers.rb +15 -15
  29. data/lib/user/config/public_folders.rb +11 -11
  30. data/lib/user/config/relationships.rb +11 -11
  31. data/lib/user/config/roles.rb +9 -9
  32. data/lib/user/config/seeds.rb +5 -5
  33. data/lib/user/config/system_settings.rb +5 -5
  34. data/lib/user/config/tags.rb +5 -5
  35. data/lib/user/config/taxonomies.rb +15 -15
  36. data/lib/user/config/teams.rb +67 -68
  37. data/lib/user/config/users.rb +70 -71
  38. data/lib/user/contacts/contacts.rb +19 -20
  39. data/lib/user/content/assets.rb +273 -278
  40. data/lib/user/content/content.rb +48 -48
  41. data/lib/user/content/content_instances.rb +136 -138
  42. data/lib/user/content/content_templates.rb +103 -103
  43. data/lib/user/content/conversations.rb +193 -193
  44. data/lib/user/content/dam.rb +83 -80
  45. data/lib/user/content/forms.rb +229 -233
  46. data/lib/user/content/message_templates.rb +152 -151
  47. data/lib/user/content/messages.rb +87 -87
  48. data/lib/user/content/pages.rb +82 -82
  49. data/lib/user/content/stories.rb +101 -101
  50. data/lib/user/content/story_templates.rb +88 -88
  51. data/lib/user/content/story_versions.rb +115 -117
  52. data/lib/user/crm/companies.rb +103 -105
  53. data/lib/user/crm/contacts.rb +285 -292
  54. data/lib/user/crm/crm.rb +19 -19
  55. data/lib/user/crm/deals.rb +103 -103
  56. data/lib/user/crm/favorites.rb +14 -13
  57. data/lib/user/crm/segments.rb +121 -123
  58. data/lib/user/crm/users.rb +20 -20
  59. data/lib/user/crm/workflow_step_objects.rb +84 -84
  60. data/lib/user/crm/workflow_steps.rb +45 -45
  61. data/lib/user/crm/workflows.rb +65 -65
  62. data/lib/user/ecommerce/ecommerce.rb +27 -27
  63. data/lib/user/ecommerce/item_prices.rb +82 -81
  64. data/lib/user/ecommerce/locations.rb +160 -160
  65. data/lib/user/ecommerce/order_items_groups.rb +107 -105
  66. data/lib/user/ecommerce/order_statuses.rb +24 -24
  67. data/lib/user/ecommerce/orders.rb +250 -246
  68. data/lib/user/ecommerce/price_lists.rb +68 -68
  69. data/lib/user/ecommerce/product_templates.rb +99 -99
  70. data/lib/user/ecommerce/product_variations.rb +122 -120
  71. data/lib/user/ecommerce/products.rb +160 -159
  72. data/lib/user/ecommerce/skus.rb +85 -85
  73. data/lib/user/ecommerce/taxes.rb +79 -79
  74. data/lib/user/ecommerce/variant_options.rb +66 -66
  75. data/lib/user/ecommerce/variant_values.rb +69 -69
  76. data/lib/user/helpers/helpers.rb +102 -101
  77. data/lib/user/helpers/object_activities.rb +78 -78
  78. data/lib/user/helpers/object_folders.rb +76 -76
  79. data/lib/user/helpers/user_folders.rb +77 -77
  80. data/lib/user/marketing/marketing.rb +114 -113
  81. data/lib/user/profile/profile.rb +94 -103
  82. data/lib/user.rb +4 -4
  83. metadata +41 -35
@@ -1,15 +1,15 @@
1
- require_relative './assets.rb'
2
- require_relative './content_instances.rb'
3
- require_relative './content_templates.rb'
4
- require_relative './conversations.rb'
5
- require_relative './dam.rb'
6
- require_relative './forms.rb'
7
- require_relative './message_templates.rb'
8
- require_relative './messages.rb'
9
- require_relative './pages.rb'
10
- require_relative './stories.rb'
11
- require_relative './story_versions.rb'
12
- require_relative './story_templates.rb'
1
+ require_relative './assets'
2
+ require_relative './content_instances'
3
+ require_relative './content_templates'
4
+ require_relative './conversations'
5
+ require_relative './dam'
6
+ require_relative './forms'
7
+ require_relative './message_templates'
8
+ require_relative './messages'
9
+ require_relative './pages'
10
+ require_relative './stories'
11
+ require_relative './story_versions'
12
+ require_relative './story_templates'
13
13
 
14
14
  module Content
15
15
  include Assets
@@ -31,7 +31,7 @@ module Content
31
31
  # ==== Example
32
32
  # @data = @mints_user.get_public_images_url
33
33
  def get_public_images_url
34
- return @client.raw("get", "/content/public-images-url")
34
+ @client.raw('get', '/content/public-images-url')
35
35
  end
36
36
 
37
37
  ##
@@ -44,7 +44,7 @@ module Content
44
44
  # ==== Example
45
45
  # @data = @mints_user.get_authors
46
46
  def get_authors
47
- return @client.raw("get", "/content/authors")
47
+ @client.raw('get', '/content/authors')
48
48
  end
49
49
 
50
50
 
@@ -57,7 +57,7 @@ module Content
57
57
  # ==== Example
58
58
  # @data = @mints_user.get_author(1)
59
59
  def get_author(id)
60
- return @client.raw("get", "/content/authors/#{id}")
60
+ @client.raw('get', "/content/authors/#{id}")
61
61
  end
62
62
 
63
63
  # === Create author.
@@ -68,12 +68,12 @@ module Content
68
68
  #
69
69
  # ==== Example
70
70
  # data = {
71
- # "title": "Howard Phillips Lovecraft",
72
- # "slug": "howard-phillips-lovecraft"
71
+ # title: 'Howard Phillips Lovecraft',
72
+ # slug: 'howard-phillips-lovecraft'
73
73
  # }
74
74
  # @data = @mints_user.create_author(data.to_json)
75
75
  def create_author(data)
76
- return @client.raw("post", "/content/authors", nil, data)
76
+ @client.raw('post', '/content/authors', nil, data)
77
77
  end
78
78
 
79
79
  # === Update author.
@@ -86,8 +86,8 @@ module Content
86
86
  # ==== Example
87
87
  #
88
88
  def update_author(id, data)
89
- #FIXME: Author controller doesnt receive data
90
- return @client.raw("put", "/content/authors/#{id}", nil, data)
89
+ # FIXME: Author controller doesnt receive data
90
+ @client.raw('put', "/content/authors/#{id}", nil, data)
91
91
  end
92
92
 
93
93
  ##
@@ -104,10 +104,10 @@ module Content
104
104
  # @data = @mints_user.get_keywords
105
105
  #
106
106
  # ==== Second Example
107
- # options = { "fields": "title" }
107
+ # options = { fields: 'title' }
108
108
  # @data = @mints_user.get_keywords(options)
109
109
  def get_keywords(options = nil)
110
- return @client.raw("get", "/content/keywords", options)
110
+ @client.raw('get', '/content/keywords', options)
111
111
  end
112
112
 
113
113
  # === Get keyword.
@@ -117,7 +117,7 @@ module Content
117
117
  # id:: (Integer) -- Keyword id.
118
118
  #
119
119
  def get_keyword(id)
120
- return @client.raw("get", "/content/keywords/#{id}")
120
+ @client.raw('get', "/content/keywords/#{id}")
121
121
  end
122
122
 
123
123
  # === Create keyword.
@@ -128,11 +128,11 @@ module Content
128
128
  #
129
129
  # ==== Example
130
130
  # data = {
131
- # "title": "New Keyword"
131
+ # title: 'New Keyword'
132
132
  # }
133
133
  # @data = @mints_user.create_keyword(data.to_json)
134
134
  def create_keyword(data)
135
- return @client.raw("post", "/content/keywords", nil, data)
135
+ @client.raw('post', '/content/keywords', nil, data)
136
136
  end
137
137
 
138
138
  # === Update keyword.
@@ -145,8 +145,8 @@ module Content
145
145
  # ==== Example
146
146
  #
147
147
  def update_keyword(id, data)
148
- #FIXME: Keyword controller doesnt receive data
149
- return @client.raw("put", "/content/keywords/#{id}", nil, data)
148
+ # FIXME: Keyword controller doesnt receive data
149
+ @client.raw('put', "/content/keywords/#{id}", nil, data)
150
150
  end
151
151
 
152
152
  ##
@@ -163,10 +163,10 @@ module Content
163
163
  # @data = @mints_user.get_stages
164
164
  #
165
165
  # ==== Second Example
166
- # options = { "fields": "title" }
166
+ # options = { fields: 'title' }
167
167
  # @data = @mints_user.get_stages(options)
168
168
  def get_stages(options = nil)
169
- return @client.raw("get", "/content/stages", options)
169
+ @client.raw('get', '/content/stages', options)
170
170
  end
171
171
 
172
172
  # === Get stage.
@@ -178,7 +178,7 @@ module Content
178
178
  # ==== Example
179
179
  # @data = @mints_user.get_stage(1)
180
180
  def get_stage(id)
181
- return @client.raw("get", "/content/stages/#{id}")
181
+ @client.raw('get', "/content/stages/#{id}")
182
182
  end
183
183
 
184
184
  # === Create stage.
@@ -189,21 +189,21 @@ module Content
189
189
  #
190
190
  # ==== Example
191
191
  # config_json = {
192
- # "count": 1
192
+ # count: 1
193
193
  # }
194
194
  # event_json = {
195
- # "rset": "DTSTART:20190214T000000Z",
196
- # "duration": 1
195
+ # rset: 'DTSTART:20190214T000000Z',
196
+ # duration: 1
197
197
  # }
198
198
  # data = {
199
- # "title": "New Stage",
200
- # "description": "New Stage Description",
201
- # "config_json": config_json.to_json,
202
- # "event_json": event_json.to_json
199
+ # title: 'New Stage',
200
+ # description: 'New Stage Description',
201
+ # config_json: config_json.to_json,
202
+ # event_json: event_json.to_json
203
203
  # }
204
204
  # @data = @mints_user.create_stage(data.to_json)
205
205
  def create_stage(data)
206
- return @client.raw("post", "/content/stages", nil, data)
206
+ @client.raw('post', '/content/stages', nil, data)
207
207
  end
208
208
 
209
209
  # === Update stage.
@@ -215,23 +215,23 @@ module Content
215
215
  #
216
216
  # ==== Example
217
217
  # config_json = {
218
- # "count": 2
218
+ # count: 2
219
219
  # }
220
220
  # event_json = {
221
- # "rset": "DTSTART:20190214T000000Z",
222
- # "duration": 2
221
+ # rset: 'DTSTART:20190214T000000Z',
222
+ # duration: 2
223
223
  # }
224
224
  # data = {
225
- # "stageProps": {
226
- # "title": "New Stage Modified",
227
- # "description": "New Stage Description Modified"
225
+ # stageProps: {
226
+ # title: 'New Stage Modified',
227
+ # description: 'New Stage Description Modified'
228
228
  # },
229
- # "config_json": config_json.to_json,
230
- # "event_json": event_json.to_json
229
+ # config_json: config_json.to_json,
230
+ # event_json: event_json.to_json
231
231
  # }
232
232
  # @data = @mints_user.update_stage(3, data.to_json)
233
233
  def update_stage(id, data)
234
- #TODO: Inform StageController.update method has been modified
235
- return @client.raw("put", "/content/stages/#{id}", nil, data)
234
+ # TODO: Inform StageController.update method has been modified
235
+ @client.raw('put', "/content/stages/#{id}", nil, data)
236
236
  end
237
237
  end
@@ -1,147 +1,145 @@
1
1
  module ContentInstances
2
- ##
3
- # == Content Instances
4
- #
2
+ ##
3
+ # == Content Instances
4
+ #
5
5
 
6
- # === Get content instances.
7
- # Get a collection of content instances.
8
- #
9
- # ==== Parameters
10
- # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
11
- #
12
- # ==== First Example
13
- # @data = @mints_user.get_content_instances
14
- #
15
- # ==== Second Example
16
- # options = { "fields": "id" }
17
- # @data = @mints_user.get_content_instances(options)
18
- def get_content_instances(options = nil)
19
- return @client.raw("get", "/content/instances", options)
20
- end
6
+ # === Get content instances.
7
+ # Get a collection of content instances.
8
+ #
9
+ # ==== Parameters
10
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
11
+ #
12
+ # ==== First Example
13
+ # @data = @mints_user.get_content_instances
14
+ #
15
+ # ==== Second Example
16
+ # options = { fields: 'id' }
17
+ # @data = @mints_user.get_content_instances(options)
18
+ def get_content_instances(options = nil)
19
+ @client.raw('get', '/content/instances', options)
20
+ end
21
21
 
22
- # === Duplicate content instance.
23
- # Duplicate a content instance.
24
- #
25
- # ==== Parameters
26
- # id:: (Integer) -- Content instance id.
27
- # data:: (Hash) -- Data to be submitted.
28
- #
29
- # ==== Example
30
- # data = {
31
- # "options": []
32
- # }
33
- # @data = @mints_user.duplicate_content_instance(1, data.to_json)
34
- def duplicate_content_instance(id, data)
35
- return @client.raw("post", "/content/instances/#{id}/duplicate", nil, data)
36
- end
37
-
38
- # === Get content instance.
39
- # Get a content instance info.
40
- #
41
- # ==== Parameters
42
- # id:: (Integer) -- Content instance id.
43
- # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
44
- #
45
- # ==== First Example
46
- # @data = @mints_user.get_content_instance(1)
47
- #
48
- # ==== Second Example
49
- # options = { "fields": "id, title" }
50
- # @data = @mints_user.get_content_instance(1, options)
51
- def get_content_instance(id, options = nil)
52
- return @client.raw("get", "/content/instances/#{id}", options)
53
- end
22
+ # === Duplicate content instance.
23
+ # Duplicate a content instance.
24
+ #
25
+ # ==== Parameters
26
+ # id:: (Integer) -- Content instance id.
27
+ # data:: (Hash) -- Data to be submitted.
28
+ #
29
+ # ==== Example
30
+ # data = { options: [] }
31
+ # @data = @mints_user.duplicate_content_instance(1, data.to_json)
32
+ def duplicate_content_instance(id, data)
33
+ @client.raw('post', "/content/instances/#{id}/duplicate", nil, data)
34
+ end
54
35
 
55
- # === Publish content instance.
56
- # Publish a content instance.
57
- #
58
- # ==== Parameters
59
- # id:: (Integer) -- Content instance id.
60
- # data:: (Hash) -- Data to be submitted.
61
- #
62
- # ==== Example
63
- # data = {
64
- # "title": "New publish",
65
- # "slug": "new-publish",
66
- # "content_template_id": 1
67
- # }
68
- # @data = @mints_user.publish_content_instance(2, data)
69
- def publish_content_instance(id, data)
70
- return @client.raw("put", "/content/instances/#{id}/publish", nil, data_transform(data))
71
- end
36
+ # === Get content instance.
37
+ # Get a content instance info.
38
+ #
39
+ # ==== Parameters
40
+ # id:: (Integer) -- Content instance id.
41
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
42
+ #
43
+ # ==== First Example
44
+ # @data = @mints_user.get_content_instance(1)
45
+ #
46
+ # ==== Second Example
47
+ # options = { fields: 'id, title' }
48
+ # @data = @mints_user.get_content_instance(1, options)
49
+ def get_content_instance(id, options = nil)
50
+ @client.raw('get', "/content/instances/#{id}", options)
51
+ end
72
52
 
73
- # === Schedule content instance.
74
- # Schedule a content instance in a specified date.
75
- #
76
- # ==== Parameters
77
- # id:: (Integer) -- Content instance id.
78
- # data:: (Hash) -- Data to be submitted.
79
- #
80
- # ==== Example
81
- # data = {
82
- # "scheduled_at": "2021-09-06T20:29:16+00:00"
83
- # }
84
- # @data = @mints_user.schedule_content_instance(1, data)
85
- def schedule_content_instance(id, data)
86
- return @client.raw("put", "/content/instances/#{id}/schedule", nil, data_transform(data))
87
- end
53
+ # === Publish content instance.
54
+ # Publish a content instance.
55
+ #
56
+ # ==== Parameters
57
+ # id:: (Integer) -- Content instance id.
58
+ # data:: (Hash) -- Data to be submitted.
59
+ #
60
+ # ==== Example
61
+ # data = {
62
+ # title: 'New publish',
63
+ # slug: 'new-publish',
64
+ # content_template_id: 1
65
+ # }
66
+ # @data = @mints_user.publish_content_instance(2, data)
67
+ def publish_content_instance(id, data)
68
+ @client.raw('put', "/content/instances/#{id}/publish", nil, data_transform(data))
69
+ end
88
70
 
89
- # === Revert published content instance.
90
- # Revert a published content instance.
91
- #
92
- # ==== Parameters
93
- # id:: (Integer) -- Content instance id.
94
- #
95
- # ==== Example
96
- # @data = @mints_user.revert_published_content_instance(1)
97
- def revert_published_content_instance(id)
98
- return @client.raw("get", "/content/instances/#{id}/revert-published-data")
99
- end
71
+ # === Schedule content instance.
72
+ # Schedule a content instance in a specified date.
73
+ #
74
+ # ==== Parameters
75
+ # id:: (Integer) -- Content instance id.
76
+ # data:: (Hash) -- Data to be submitted.
77
+ #
78
+ # ==== Example
79
+ # data = {
80
+ # scheduled_at: '2021-09-06T20:29:16+00:00'
81
+ # }
82
+ # @data = @mints_user.schedule_content_instance(1, data)
83
+ def schedule_content_instance(id, data)
84
+ @client.raw('put', "/content/instances/#{id}/schedule", nil, data_transform(data))
85
+ end
100
86
 
101
- # === Create content instance.
102
- # Create a content instance with data.
103
- #
104
- # ==== Parameters
105
- # data:: (Hash) -- Data to be submitted.
106
- #
107
- # ==== Example
108
- # data = {
109
- # "title": "New Content Instance",
110
- # "content_template_id": 1,
111
- # "slug": "new-content-instance-slug"
112
- # }
113
- # @data = @mints_user.create_content_instance(data)
114
- def create_content_instance(data)
115
- return @client.raw("post", "/content/instances", nil, data_transform(data))
116
- end
87
+ # === Revert published content instance.
88
+ # Revert a published content instance.
89
+ #
90
+ # ==== Parameters
91
+ # id:: (Integer) -- Content instance id.
92
+ #
93
+ # ==== Example
94
+ # @data = @mints_user.revert_published_content_instance(1)
95
+ def revert_published_content_instance(id)
96
+ @client.raw('get', "/content/instances/#{id}/revert-published-data")
97
+ end
117
98
 
118
- # === Update content instance.
119
- # Update a content instance info.
120
- #
121
- # ==== Parameters
122
- # id:: (Integer) -- Content instance id.
123
- # data:: (Hash) -- Data to be submitted.
124
- #
125
- # ==== Example
126
- # data = {
127
- # "title": "New Content Instance Modified",
128
- # "content_template_id": 1,
129
- # "slug": "new-content-instance-slug"
130
- # }
131
- # @data = @mints_user.update_content_instance(18, data)
132
- def update_content_instance(id, data)
133
- return @client.raw("put", "/content/instances/#{id}", nil, data_transform(data))
134
- end
99
+ # === Create content instance.
100
+ # Create a content instance with data.
101
+ #
102
+ # ==== Parameters
103
+ # data:: (Hash) -- Data to be submitted.
104
+ #
105
+ # ==== Example
106
+ # data = {
107
+ # title: 'New Content Instance',
108
+ # content_template_id: 1,
109
+ # slug: 'new-content-instance-slug'
110
+ # }
111
+ # @data = @mints_user.create_content_instance(data)
112
+ def create_content_instance(data)
113
+ @client.raw('post', '/content/instances', nil, data_transform(data))
114
+ end
135
115
 
136
- # === Delete content instance.
137
- # Delete a content instance.
138
- #
139
- # ==== Parameters
140
- # id:: (Integer) -- Content instance id.
141
- #
142
- # ==== Example
143
- # @data = @mints_user.delete_content_instance(20)
144
- def delete_content_instance(id)
145
- return @client.raw("delete", "/content/instances/#{id}")
146
- end
147
- end
116
+ # === Update content instance.
117
+ # Update a content instance info.
118
+ #
119
+ # ==== Parameters
120
+ # id:: (Integer) -- Content instance id.
121
+ # data:: (Hash) -- Data to be submitted.
122
+ #
123
+ # ==== Example
124
+ # data = {
125
+ # title: "New Content Instance Modified",
126
+ # content_template_id: 1,
127
+ # slug: "new-content-instance-slug"
128
+ # }
129
+ # @data = @mints_user.update_content_instance(18, data)
130
+ def update_content_instance(id, data)
131
+ @client.raw('put', "/content/instances/#{id}", nil, data_transform(data))
132
+ end
133
+
134
+ # === Delete content instance.
135
+ # Delete a content instance.
136
+ #
137
+ # ==== Parameters
138
+ # id:: (Integer) -- Content instance id.
139
+ #
140
+ # ==== Example
141
+ # @data = @mints_user.delete_content_instance(20)
142
+ def delete_content_instance(id)
143
+ @client.raw('delete', "/content/instances/#{id}")
144
+ end
145
+ end