mints 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f269f998c9cc9cb3dc69f3ec70cc2ff4522a97c14a9da0bfb6ca4cba40b0654
4
- data.tar.gz: e6b867ce7e3623b05c7aad402462f09b0b1a71a3750549c669407bcff6d2aa2b
3
+ metadata.gz: 0cff6a549992ee75536a6696575ef58435328068adcbdd3658fc6633ec0e4fd5
4
+ data.tar.gz: c2fc848075d8156ba44aadc01c45b0d01c6eeaf5a7a21201d38b51e99ad86d54
5
5
  SHA512:
6
- metadata.gz: 1128997e3df23340e780e4dcc9bb84389df6062eaae3683dff653b440887a5c4d04059141e8472e3762c3ce856df795c26ef7e376c72c38e494880aef5ab830b
7
- data.tar.gz: '09b6774bb218dc40cd0083fc54428225999736f5452911c7b482a22b928d41dea91fe343ecbab96543be6c602393f6f13aaa9d9d1ee489b8e4a697bf61eda20f'
6
+ metadata.gz: e865b46eb2536dd6f14ad39d0ebe691ec2db0cf98bd3c1861223dd3e9462deb555eee92d3ece5da498cbd4655dc6443774e6ca1ea94c0225f5a8db1977a7b237
7
+ data.tar.gz: f5203d5ba1b426812abd7f281146c84b58c2761e1be388b0ed004bd74ccd98000964615787d127a275848978fc029f444db2f8647f6a924df918814cf3f3c856
data/lib/client.rb CHANGED
@@ -72,6 +72,9 @@ module Mints
72
72
  elsif action === 'put' or action === 'patch' or action ==='update'
73
73
  action = 'put'
74
74
  response = self.send("#{@scope}_#{action}", "#{full_url}", data)
75
+ elsif action === 'delete' or action === 'destroy'
76
+ action = 'delete'
77
+ response = self.send("#{@scope}_#{action}", "#{full_url}", data)
75
78
  end
76
79
  if result_from_cache
77
80
  return parsed_response = JSON.parse(response)
@@ -93,7 +96,7 @@ module Mints
93
96
  name_len = name_spplited.size
94
97
  # the action always be the first element
95
98
  action = name_spplited.first
96
- raise 'NoActionError' unless ['get', 'create', 'post', 'update', 'put'].include?(action)
99
+ raise 'NoActionError' unless ['get', 'create', 'post', 'update', 'put', 'delete', 'destroy'].include?(action)
97
100
  # the object always be the last element
98
101
  object = separator == "__" ? name_spplited.last.gsub("_","-") : name_spplited.last
99
102
  # get intermediate url elements
@@ -188,6 +191,7 @@ module Mints
188
191
  puts url
189
192
  puts "Headers:"
190
193
  puts headers
194
+ puts "Method: get"
191
195
  end
192
196
  return headers ? HTTParty.get(url, :headers => headers) : HTTParty.get(url)
193
197
  end
@@ -201,6 +205,7 @@ module Mints
201
205
  puts headers
202
206
  puts "Data:"
203
207
  puts data
208
+ puts "Method: post"
204
209
  end
205
210
  return headers ? HTTParty.post(url, :headers=> headers, :body => data) : HTTParty.post(url, :body => data)
206
211
  end
@@ -214,10 +219,25 @@ module Mints
214
219
  puts headers
215
220
  puts "Data:"
216
221
  puts data
222
+ puts "Method: put"
217
223
  end
218
224
  return headers ? HTTParty.put(url, :headers=> headers, :body => data) : HTTParty.put(url, :body => data)
219
225
  end
220
226
 
227
+ # Simple HTTP DELETE
228
+ def http_delete(url, headers = nil, data = nil)
229
+ if @debug
230
+ puts "Url:"
231
+ puts url
232
+ puts "Headers:"
233
+ puts headers
234
+ puts "Data:"
235
+ puts data
236
+ puts "Method: delete"
237
+ end
238
+ return headers ? HTTParty.delete(url, :headers=> headers, :body => data) : HTTParty.delete(url, :body => data)
239
+ end
240
+
221
241
  # Start contact context
222
242
  def contact_get(url)
223
243
  headers = {
@@ -277,6 +297,15 @@ module Mints
277
297
  headers["Authorization"] = "Bearer #{@session_token}" if @session_token
278
298
  return self.http_put(url, headers, data)
279
299
  end
300
+
301
+ def user_delete(url, data)
302
+ headers = {
303
+ "ApiKey" => @api_key,
304
+ "Accept" => "application/json"
305
+ }
306
+ headers["Authorization"] = "Bearer #{@session_token}" if @session_token
307
+ return self.http_delete(url, headers, data)
308
+ end
280
309
  # End User Context
281
310
 
282
311
  def public_get(url, headers = nil)
@@ -22,7 +22,7 @@ module Mints
22
22
  # Get session token from response
23
23
  session_token = response['api_token']
24
24
  # Set a permanent cookie with the session token
25
- cookies.permanent[:mints_user_session_token] = session_token
25
+ cookies[:mints_user_session_token] = { value: session_token, secure: true, httponly: true, expires: 1.day }
26
26
  end
27
27
 
28
28
  ##
@@ -33,7 +33,7 @@ module Mints
33
33
  response = @mints_user.magic_link_login(hash)
34
34
  if response['data'] && response['data']['redirect_url']
35
35
  # Set a cookie with the session token
36
- cookies[:mints_user_session_token] = { value: response['data']['api_token'], expires: 1.day }
36
+ cookies[:mints_user_session_token] = { value: response['data']['api_token'], expires: 1.day, secure: true, httponly: true }
37
37
  redirect_to response['data']['redirect_url']
38
38
  else
39
39
  redirect_to '/'
@@ -10,10 +10,10 @@ module Mints
10
10
  response = @mints_contact.login(email, password)
11
11
  # Get session token from response
12
12
  session_token = response['session_token']
13
- id_token = response['contact']['id_token']
13
+ id_token = response['contact']['contact_token']
14
14
  # Set a permanent cookie with the session token
15
- cookies.permanent[:mints_contact_session_token] = session_token
16
- cookies.permanent[:mints_contact_id] = id_token
15
+ cookies.permanent[:mints_contact_session_token] = { value: session_token, secure: true, httponly: true }
16
+ cookies.permanent[:mints_contact_id] = { value: id_token, secure: true, httponly: true }
17
17
  @contact_token = id_token
18
18
  end
19
19
 
@@ -26,10 +26,10 @@ module Mints
26
26
  if response['data']
27
27
  # Get session token from response
28
28
  session_token = response['data']['session_token']
29
- id_token = response['data']['contact']['id_token']
29
+ id_token = response['data']['contact']['contact_token']
30
30
  # Set a permanent cookie with the session token
31
- cookies.permanent[:mints_contact_session_token] = session_token
32
- cookies.permanent[:mints_contact_id] = id_token
31
+ cookies.permanent[:mints_contact_session_token] = { value: session_token, secure: true, httponly: true }
32
+ cookies.permanent[:mints_contact_id] = { value: id_token, secure: true, httponly: true }
33
33
  @contact_token = id_token
34
34
  redirect_to response['data']['redirect_url'] ? response['data']['redirect_url'] : '/'
35
35
  else
@@ -58,7 +58,7 @@ module Mints
58
58
  # Get session token from response
59
59
  session_token = response['api_token']
60
60
  # Set a permanent cookie with the session token
61
- cookies.permanent[:mints_user_session_token] = session_token
61
+ cookies[:mints_user_session_token] = { value: session_token, secure: true, httponly: true, expires: 1.day }
62
62
  end
63
63
 
64
64
  ##
@@ -69,7 +69,7 @@ module Mints
69
69
  response = @mints_user.magic_link_login(hash)
70
70
  if response['data']
71
71
  # Set a cookie with the session token
72
- cookies[:mints_user_session_token] = { value: response['data']['api_token'], expires: 1.day }
72
+ cookies[:mints_user_session_token] = { value: response['data']['api_token'], secure: true, httponly: true, expires: 1.day }
73
73
  redirect_to response['data']['redirect_url'] ? response['data']['redirect_url'] : '/'
74
74
  else
75
75
  redirect_to '/'
@@ -24,10 +24,10 @@ module Mints
24
24
  response = @mints_contact.login(email, password)
25
25
  # Get session token from response
26
26
  session_token = response['session_token']
27
- id_token = response['contact']['id_token']
27
+ id_token = response['contact']['contact_token']
28
28
  # Set a permanent cookie with the session token
29
- cookies.permanent[:mints_contact_session_token] = session_token
30
- cookies.permanent[:mints_contact_id] = id_token
29
+ cookies.permanent[:mints_contact_session_token] = { value: session_token, secure: true, httponly: true }
30
+ cookies.permanent[:mints_contact_id] = { value: id_token, secure: true, httponly: true }
31
31
  @contact_token = id_token
32
32
  end
33
33
 
@@ -39,10 +39,10 @@ module Mints
39
39
  response = @mints_contact.login(email, password)
40
40
  # Get session token from response
41
41
  session_token = response['session_token']
42
- id_token = response['contact']['id_token']
42
+ id_token = response['contact']['contact_token']
43
43
  # Set a permanent cookie with the session token
44
- cookies.permanent[:mints_contact_session_token] = session_token
45
- cookies.permanent[:mints_contact_id] = id_token
44
+ cookies.permanent[:mints_contact_session_token] = { value: session_token, secure: true, httponly: true }
45
+ cookies.permanent[:mints_contact_id] = { value: id_token, secure: true, httponly: true }
46
46
  @contact_token = id_token
47
47
  end
48
48
 
@@ -64,10 +64,25 @@ module Mints
64
64
  # === Register visit.
65
65
  # Call register visit method from the public client and set/renew the cookie mints_contact_id
66
66
  def register_visit
67
+ if @debug
68
+ puts "REQUEST IN REGISTER VISIT: #{request}"
69
+ puts "BODY REQUEST: #{request.body}"
70
+ puts "AUTH REQUEST: #{request.authorization}"
71
+ puts "LENGTH REQUEST: #{request.content_length}"
72
+ puts "FORM DATA REQUEST: #{request.form_data?}"
73
+ puts "FULLPATH REQUEST: #{request.fullpath}"
74
+ puts "HEADERS REQUEST: #{request.headers}"
75
+ puts "IP REQUEST: #{request.ip}"
76
+ puts "REQUEST IP ADRESS: #{request['ip_address']}"
77
+ puts "REQUEST REMOTE IP: #{request['remote_ip']}"
78
+ end
67
79
  response = @mints_pub.register_visit(request)
68
- @contact_token = response['user_token']
80
+ if @debug
81
+ puts "RESPONSE IN REGISTER VISIT: #{response}"
82
+ end
83
+ @contact_token = response['contact_token']
69
84
  @visit_id = response['visit_id']
70
- cookies.permanent[:mints_contact_id] = @contact_token
85
+ cookies.permanent[:mints_contact_id] = { value: @contact_token, secure: true, httponly: true }
71
86
  end
72
87
 
73
88
  ##
data/lib/user.rb CHANGED
@@ -30,6 +30,7 @@ module Mints
30
30
  attr_reader :client
31
31
  def initialize(host, api_key, session_token = nil, debug = false)
32
32
  @client = Mints::Client.new(host, api_key, 'user', session_token, nil, debug)
33
+ @content_route = '/api/user/v1/content'
33
34
  end
34
35
 
35
36
  def login(email, password)
@@ -69,6 +70,21 @@ module Mints
69
70
  return @client.get__profile__me
70
71
  end
71
72
  ######################################### CRM #########################################
73
+
74
+ #TODO: Add options to every method and test
75
+
76
+ ##
77
+ # == Contacts
78
+ #
79
+
80
+ def get_support_datas #TODO: rename
81
+ return @client.raw("get", "/crm/contacts/support-data")
82
+ end
83
+
84
+ def get_online_activity(id)
85
+ return @client.raw("get", "/crm/contacts/#{id}/online-activity")
86
+ end
87
+
72
88
  ##
73
89
  # === Get contacts.
74
90
  # Get a collection of contacts
@@ -76,40 +92,91 @@ module Mints
76
92
  # ==== Parameters
77
93
  # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
78
94
  def get_contacts(options = nil)
79
- return @client.get__crm__contacts(options)
95
+ return @client.raw("get", "/crm/contacts", options)
80
96
  end
81
97
 
82
98
  def get_contact(id, options = nil)
83
- return @client.get__crm__contacts(id, options)
99
+ return @client.raw("get", "/crm/contacts/#{id}", options)
84
100
  end
85
101
 
86
102
  def create_contact(data, options = nil)
87
- return @client.create__crm__contacts(data, options)
103
+ return @client.raw("post", "/crm/contacts", options, data)
88
104
  end
89
105
 
90
106
  def update_contact(id, data, options = nil)
91
- return @client.update__crm__contacts(id, data, options)
107
+ return @client.raw("put", "/crm/contacts/#{id}", options, data)
92
108
  end
93
-
94
- # === Get companies.
95
- # Get a collection of companies
109
+
110
+ def get_contact_deals(contact_id)
111
+ return @client.raw("get", "/crm/contacts/#{contact_id}/deals")
112
+ end
113
+
114
+ def create_contact_deals(contact_id, data)
115
+ return @client.raw("post", "/crm/contacts/#{contact_id}/deals", nil, data)
116
+ end
117
+
118
+ def delete_contact_deals(contact_id, data) #FIXME: MethodNotAllowedHttpException
119
+ return @client.raw("delete", "/crm/contacts/#{contact_id}/deals", nil, data)
120
+ end
121
+
122
+ def get_contact_users(contact_id, options = nil)
123
+ return @client.raw("get", "/crm/contacts/#{contact_id}/users", options)
124
+ end
125
+
126
+ def create_contact_users(contact_id, data)
127
+ return @client.raw("post", "/crm/contacts/#{contact_id}/users", nil, data)
128
+ end
129
+
130
+ def delete_contact_users(contact_id, data) #FIXME: MethodNotAllowedHttpException
131
+ return @client.raw("delete", "/crm/contacts/#{contact_id}/users", nil, data)
132
+ end
133
+
134
+ def get_contact_segments(contact_id)
135
+ return @client.raw("get", "/crm/contacts/#{contact_id}/segments")
136
+ end
137
+
138
+ def get_contact_submissions(contact_id)
139
+ return @client.raw("get", "/crm/contacts/#{contact_id}/submissions")
140
+ end
141
+
142
+ def get_contact_tags(contact_id)
143
+ return @client.raw("get", "/crm/contacts/#{contact_id}/tags")
144
+ end
145
+
146
+ def get_contact_magic_links(contact_id)
147
+ return @client.raw("get", "/crm/contacts/#{contact_id}/magic-links")
148
+ end
149
+
150
+ def create_contact_merge(id, data)
151
+ return @client.raw("post", "/crm/contacts/#{id}/merge")
152
+ end
153
+
154
+ def send_magic_links(data)
155
+ return @client.raw("post", "/crm/contacts/send-magic-link", nil, data)
156
+ end
157
+
158
+ ##
159
+ # == Contacts Bulk Actions
96
160
  #
97
- # ==== Parameters
98
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
99
- def get_companies(options = nil)
100
- return @client.get__crm__companies(options)
161
+
162
+ def delete_contacts(data)
163
+ return @client.raw("delete", "/crm/contacts/delete", nil, data)
101
164
  end
102
165
 
103
- def get_company(id, options = nil)
104
- return @client.get__crm__companies(id, options)
166
+ ##
167
+ # == Deals
168
+ #
169
+
170
+ def get_deal_permits(id)
171
+ return @client.raw("get", "/crm/deals/#{id}/permits")
105
172
  end
106
173
 
107
- def create_company(data, options = nil)
108
- return @client.create__crm__companies(data, options)
174
+ def get_deal_support_data
175
+ return @client.raw("get", "/crm/deals/support-data")
109
176
  end
110
177
 
111
- def update_company(id, data, options = nil)
112
- return @client.update__crm__companies(id, data, options)
178
+ def get_deal_currencies
179
+ return @client.raw("get", "/crm/deal/currencies")
113
180
  end
114
181
 
115
182
  # === Get deals.
@@ -118,104 +185,260 @@ module Mints
118
185
  # ==== Parameters
119
186
  # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
120
187
  def get_deals(options = nil)
121
- return @client.get__crm__deals(options)
188
+ return @client.raw("get", "/crm/deals", options)
122
189
  end
123
190
 
124
191
  def get_deal(id, options = nil)
125
- return @client.get__crm__deals(id, options)
192
+ return @client.raw("get", "/crm/deals/#{id}", options)
126
193
  end
127
194
 
128
- def create_deal(data, options = nil)
129
- return @client.create__crm__deals(data, options)
195
+ def create_deal(data)
196
+ return @client.raw("post", "/crm/deals", nil, data)
130
197
  end
131
198
 
132
- def update_deal(id, data, options = nil)
133
- return @client.update__crm__deals(id, data, options)
199
+ def update_deal(id, data)
200
+ return @client.raw("put", "/crm/deals/#{id}", nil, data)
134
201
  end
135
202
 
136
- ######################################### Content #########################################
137
- # === Get stories.
138
- # Get a collection of stories
203
+ ##
204
+ # == Companies
205
+ #
206
+
207
+ def get_companies_support_data
208
+ return @client.raw("get", "/crm/companies/support-data")
209
+ end
210
+
211
+ # === Get companies.
212
+ # Get a collection of companies
139
213
  #
140
214
  # ==== Parameters
141
215
  # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
142
- def get_stories(options = nil)
143
- return @client.get__content__stories(options)
216
+ def get_companies(options = nil)
217
+ return @client.raw("get", "/crm/companies", options)
144
218
  end
145
219
 
146
- def get_story(id, options = nil)
147
- return @client.get__content__stories(id, options)
220
+ def get_company(id, options = nil)
221
+ return @client.raw("get", "/crm/companies/#{id}", options)
148
222
  end
149
223
 
150
- def create_story(data, options = nil)
151
- return @client.create__content__stories(data, options)
224
+ def create_company(data)
225
+ return @client.raw("post", "/crm/companies/", nil, data)
152
226
  end
153
227
 
154
- def update_story(id, data, options = nil)
155
- return @client.update__content__stories(id, data, options)
228
+ def update_company(id, data)
229
+ return @client.raw("put", "/crm/companies/#{id}", nil, data)
156
230
  end
157
231
 
158
- # === Get story templates.
159
- # Get a collection of story templates
232
+ ##
233
+ # == Companies Bulk Actions
160
234
  #
161
- # ==== Parameters
162
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
163
- def get_story_templates(options = nil)
164
- return @client.get__content__story_templates(options)
235
+
236
+ def delete_companies(data)
237
+ return @client.raw("delete", "/crm/companies/delete", nil, data)
165
238
  end
166
239
 
167
- def get_story_template(id, options = nil)
168
- return @client.get__content__story_templates(id, options)
240
+ ##
241
+ # == Workflows
242
+ #
243
+
244
+ def get_workflows(options = nil)
245
+ return @client.raw("get", "/crm/workflows", options)
169
246
  end
170
247
 
171
- def create_story_template(data, options = nil)
172
- return @client.create__content__story_templates(data, options)
248
+ def get_workflow(id, options = nil)
249
+ return @client.raw("get", "/crm/workflows/#{id}", options)
173
250
  end
174
251
 
175
- def update_story_template(id, data, options = nil)
176
- return @client.update__content__story_templates(id, data, options)
252
+ def create_workflow(data)
253
+ return @client.raw("post", "/crm/workflows/", nil, data)
177
254
  end
178
255
 
179
- # === Get content instances.
180
- # Get a collection of content instances
256
+ def update_workflow(id, data)
257
+ return @client.raw("put", "/crm/workflows/#{id}", nil, data)
258
+ end
259
+
260
+ ##
261
+ # == Workflow Step Objects
181
262
  #
182
- # ==== Parameters
183
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
184
- def get_content_instances(options = nil)
185
- return @client.get__content__instances(options)
263
+
264
+ def get_step_objects(options = nil)
265
+ return @client.raw("get", "/crm/step-objects", options)
186
266
  end
187
267
 
188
- def get_content_instance(id, options = nil)
189
- return @client.get__content__instances(id, options)
268
+ def get_step_object(id, options = nil)
269
+ return @client.raw("get", "/crm/step-objects/#{id}", options)
270
+ end
271
+
272
+ def create_step_object(data)
273
+ return @client.raw("post", "/crm/step-objects/", nil, data)
190
274
  end
191
275
 
192
- def create_content_instance(data, options = nil)
193
- return @client.create__content__instances(data, options)
276
+ def update_step_object(id, data)
277
+ return @client.raw("put", "/crm/step-objects/#{id}", nil, data)
194
278
  end
195
279
 
196
- def update_content_instance(id, data, options = nil)
197
- return @client.update__content__instances(id, data, options)
280
+ def get_step_object_by_object_type(objectType, objectId, options = nil)
281
+ return @client.raw("get", "/crm/step-objects/#{objectType}/#{objectId}", options)
198
282
  end
199
283
 
200
- # === Get content pages.
201
- # Get a collection of content pages
284
+ ##
285
+ # == Workflow Steps
202
286
  #
203
- # ==== Parameters
204
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
205
- def get_content_pages(options = nil)
206
- return @client.get__content__pages(options)
287
+
288
+ def create_workflow_step(data)
289
+ return @client.raw("post", "/crm/steps", nil, data)
290
+ end
291
+
292
+ def update_workflow_step(id, data)
293
+ return @client.raw("put", "/crm/steps/#{id}", nil, data)
294
+ end
295
+
296
+ def delete_workflow_step(id) #FIXME: DELETE DOESN'T WORK
297
+ return @client.raw("delete", "/crm/steps/#{id}")
298
+ end
299
+
300
+ ##
301
+ # == Favorites #TODO: NOT CHECKED, NO DATA IN DB
302
+ #
303
+
304
+ def update_multiple_favorites(data)
305
+ return @client.raw("put", "/crm/favorites", nil, data)
306
+ end
307
+
308
+ def get_favorites(options = nil)
309
+ return @client.raw("get", "/crm/favorites", options)
310
+ end
311
+
312
+ def update_favorites(id, data)
313
+ return @client.raw("put", "/crm/favorites/#{id}", nil, data)
314
+ end
315
+
316
+ ##
317
+ # == Segments
318
+ #
319
+
320
+ def get_segment_support_datas
321
+ return @client.raw("get", "/crm/segments/support-data")
322
+ end
323
+
324
+ def get_segment_attributes(options = nil)
325
+ return @client.raw("get", "/crm/segments/attributes", options)
326
+ end
327
+
328
+ def get_segment_group(groupId)
329
+ return @client.raw("get", "/crm/segments/groups/#{groupId}")
330
+ end
331
+
332
+ def duplicate_segment(id, data)
333
+ return @client.raw("post", "/crm/segments/#{id}/duplicate", nil, data)
334
+ end
335
+
336
+ def get_segments(options = nil)
337
+ return @client.raw("get", "/crm/segments", options)
338
+ end
339
+
340
+ def get_segment(id, options = nil)
341
+ return @client.raw("get", "/crm/segments/#{id}", options)
342
+ end
343
+
344
+ def create_segment(data)
345
+ return @client.raw("post", "/crm/segments", nil, data)
346
+ end
347
+
348
+ def update_segment(id, data)
349
+ return @client.raw("put", "/crm/segments/#{id}", nil, data)
350
+ end
351
+
352
+ def delete_segment(id)
353
+ return @client.raw("delete", "/crm/segments/#{id}")
354
+ end
355
+
356
+ ##
357
+ # == Users
358
+ #
359
+
360
+ def get_users(options = nil)
361
+ return @client.raw("get", "/crm/users", options, nil)
362
+ end
363
+
364
+
365
+ ######################################### Content #########################################
366
+
367
+
368
+ ##
369
+ # == Pages
370
+ #
371
+
372
+ def get_pages_groups
373
+ return @client.raw("get", "/content/pages/groups")
374
+ end
375
+
376
+ def get_pages
377
+ return @client.raw("get", "/content/pages")
378
+ end
379
+
380
+ def get_page(id)
381
+ return @client.raw("get", "/content/pages/#{id}")
382
+ end
383
+
384
+ def create_page(data)
385
+ return @client.raw("post", "/content/pages", nil, data)
386
+ end
387
+
388
+ def update_page(id, data)
389
+ return @client.raw("put", "/content/pages/#{id}", nil, data)
390
+ end
391
+
392
+ def delete_page(id)
393
+ return @client.raw("delete", "/content/pages/#{id}")
394
+ end
395
+
396
+ ##
397
+ # == Forms
398
+ #
399
+
400
+ def get_forms(options = nil)
401
+ return @client.raw("get", "/content/forms", options)
207
402
  end
208
403
 
209
- def get_content_page(id, options = nil)
210
- return @client.get__content__pages(id, options)
404
+ def get_form(id, options = nil)
405
+ return @client.raw("get", "/content/forms/#{id}", options)
211
406
  end
212
407
 
213
- def create_content_page(data, options = nil)
214
- return @client.create__content__pages(data, options)
408
+ def duplicate_form(id)
409
+ return @client.raw("post", "/content/forms/#{id}/duplicate")
215
410
  end
216
411
 
217
- def update_content_page(id, data, options = nil)
218
- return @client.update__content__pages(id, data, options)
412
+ def get_form_support_data()
413
+ return @client.raw("get", "/content/forms/support-data")
414
+ end
415
+
416
+ def get_form_submissions(options = nil)
417
+ return @client.raw("get", "/content/forms/submissions", options)
418
+ end
419
+
420
+ def create_form(data)
421
+ return @client.raw("post", "/content/forms", nil, data)
422
+ end
423
+
424
+ def update_form(id, data)
425
+ return @client.raw("put", "/content/forms/#{id}", nil, data)
426
+ end
427
+
428
+ def delete_form(id)
429
+ return @client.raw("delete", "/content/forms/#{id}")
430
+ end
431
+
432
+ ##
433
+ # == Content templates
434
+ #
435
+
436
+ def get_content_template_instances(templateId)
437
+ return @client.raw("get", "/content/templates/#{templateId}/instances")
438
+ end
439
+
440
+ def duplicate_content_template(id)
441
+ return @client.raw("post", "/content/templates/#{id}/duplicate/")
219
442
  end
220
443
 
221
444
  # === Get content templates.
@@ -224,209 +447,542 @@ module Mints
224
447
  # ==== Parameters
225
448
  # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
226
449
  def get_content_templates(options = nil)
227
- return @client.get__content__templates(options)
450
+ return @client.raw("get", "/content/templates", options)
228
451
  end
229
452
 
230
- def get_content_template(id, options = nil)
231
- return @client.get__content__templates(id, options)
453
+ def get_content_template(id)
454
+ return @client.raw("get", "/content/templates/#{id}")
232
455
  end
233
456
 
234
- def create_content_template(data, options = nil)
235
- return @client.create__content__templates(data, options)
457
+ def create_content_template(data)
458
+ #FIXME: Method doesn't work, controller cannot get template info from request variable.
459
+ return @client.raw("post", "/content/templates", nil, data)
236
460
  end
237
461
 
238
- def update_content_template(id, data, options = nil)
239
- return @client.update__content__templates(id, data, options)
462
+ def update_content_template(id, data)
463
+ #FIXME: Method doesn't work, controller cannot get template info from request variable.
464
+ return @client.raw("put", "/content/templates/#{id}", nil, data)
240
465
  end
241
466
 
242
- # === Get products.
243
- # Get a collection of products
467
+ def delete_content_template(id)
468
+ #TODO: NOT TESTED
469
+ return @client.raw("delete", "/content/templates/#{id}")
470
+ end
471
+
472
+ ##
473
+ # == Content Instances
474
+ #
475
+
476
+ # === Get content instances.
477
+ # Get a collection of content instances
244
478
  #
245
479
  # ==== Parameters
246
480
  # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
247
- def get_products(options = nil)
248
- return @client.get__ecommerce__products(options)
481
+ def get_content_instances(options = nil)
482
+ return @client.raw("get", "/content/instances", options)
249
483
  end
250
484
 
251
- def get_product(id, options = nil)
252
- return @client.get__ecommerce__products(id, options)
485
+ def duplicate_content_instance(id, data)
486
+ return @client.raw("post", "/content/instances/#{id}/duplicate", nil, data)
487
+ end
488
+
489
+ def get_content_instance(id, options = nil)
490
+ return @client.raw("get", "/content/instances/#{id}", options)
491
+ end
492
+
493
+ def publish_content_instance(id, data)
494
+ return @client.raw("put", "/content/instances/#{id}/publish", nil, data)
495
+ end
496
+
497
+ def schedule_content_instance(id, data) #FIXME: Undefined index: scheduled_at
498
+ return @client.raw("put", "/content/instances/#{id}/schedule", nil, data)
499
+ end
500
+
501
+ def revert_published_data_from_content_instance(id)
502
+ return @client.raw("get", "/content/instances/#{id}/revert-published-data")
503
+ end
504
+
505
+ def create_content_instance(data)
506
+ return @client.raw("post", "/content/instances", nil, data)
253
507
  end
254
508
 
255
- def create_product(data, options = nil)
256
- return @client.create__ecommerce__products(data, options)
509
+ def update_content_instance(id, data)
510
+ return @client.raw("put", "/content/instances/#{id}", nil, data)
257
511
  end
258
512
 
259
- def update_product(id, data, options = nil)
260
- return @client.update__ecommerce__products(id, data, options)
513
+ def delete_content_instance(id)
514
+ return @client.raw("delete", "/content/instances/#{id}")
261
515
  end
262
516
 
263
- # === Get skus.
264
- # Get a collection of skus
517
+ ##
518
+ # == OTHER
265
519
  #
266
- # ==== Parameters
267
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
268
- def get_skus(options = nil)
269
- return @client.get__ecommerce__skus(options)
520
+
521
+ def get_authors
522
+ return @client.raw("get", "/content/authors")
270
523
  end
271
524
 
272
- def get_sku(id, options = nil)
273
- return @client.get__ecommerce__skus(id, options)
525
+ def get_keywords(options = nil)
526
+ return @client.raw("get", "/content/keywords", options)
274
527
  end
275
528
 
276
- def create_sku(data, options = nil)
277
- return @client.create__ecommerce__skus(data, options)
529
+ def get_public_images_url
530
+ return @client.raw("get", "/content/public-images-url")
278
531
  end
279
532
 
280
- def update_sku(id, data, options = nil)
281
- return @client.update__ecommerce__skus(id, data, options)
533
+ def get_stages(options = nil)
534
+ return @client.raw("get", "/content/stages", options)
282
535
  end
283
536
 
284
- # === Get prices.
285
- # Get a collection of prices
537
+ ##
538
+ # == dam
286
539
  #
287
- # ==== Parameters
288
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
289
- def get_prices(options = nil)
290
- return @client.get__ecommerce__prices(options)
540
+
541
+ def get_dam_loadtree
542
+ return @client.raw("get", "/content/dam/loadtree")
543
+ end
544
+
545
+ def get_dam_asset_locations(options)
546
+ return @client.raw("get", "/content/dam/asset-locations", options)
547
+ end
548
+
549
+ def paste_dam(data) #FIXME: Invalid argument supplied for foreach()
550
+ return @client.raw("post", "/content/dam/paste", nil, data)
291
551
  end
292
552
 
293
- def get_price(id, options = nil)
294
- return @client.get__ecommerce__prices(id, options)
553
+ def rename_dam(data) #TODO: No validate
554
+ return @client.raw("post", "/content/dam/rename", nil, data)
295
555
  end
296
556
 
297
- def create_price(data, options = nil)
298
- return @client.create__ecommerce__prices(data, options)
557
+ def search_dam(data)
558
+ return @client.raw("post", "/content/dam/search", nil, data)
299
559
  end
300
560
 
301
- def update_price(id, data, options = nil)
302
- return @client.update__ecommerce__prices(id, data, options)
561
+ def send_to_trash_dam(data) #FIXME: Invalid argument supplied for foreach()
562
+ return @client.raw("post", "/content/dam/sendToTrash", nil, data)
303
563
  end
304
564
 
305
- # === Get prece lists.
306
- # Get a collection of prece lists
565
+ def delete_dam(data) #FIXME: Invalid argument supplied for foreach()
566
+ return @client.raw("post", "/content/dam/delete", nil, data)
567
+ end
568
+
569
+ def create_dam_folder(data)
570
+ return @client.raw("post", "/content/folders/create", nil, data)
571
+ end
572
+
573
+ ##
574
+ # == Assets
307
575
  #
308
- # ==== Parameters
309
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
310
- def get_price_lists(options = nil)
311
- return @client.get__ecommerce__price_lists(options)
576
+
577
+ def create_asset(data) #TODO: ask for renaming to 'upload asset'
578
+ return @client.raw("post", "/content/assets/upload", nil, data)
312
579
  end
313
580
 
314
- def get_price_list(id, options = nil)
315
- return @client.get__ecommerce__price_lists(id, options)
581
+ def get_asset_link_info(data)
582
+ return @client.raw("post", "/content/assets/getLinkInfo", nil, data)
316
583
  end
317
584
 
318
- def create_price_list(data, options = nil)
319
- return @client.create__ecommerce__price_lists(data, options)
585
+ def download_asset(id) #FIXME: File not found at path
586
+ return @client.raw("get", "/content/assets/download/#{id}")
320
587
  end
321
588
 
322
- def update_price_list(id, data, options = nil)
323
- return @client.update__ecommerce__price_lists(id, data, options)
589
+ def edit_asset_size(data) #TODO: Not tested
590
+ return @client.raw("post", "/content/assets/editSize", nil, data)
324
591
  end
325
592
 
326
- # === Get product brands.
327
- # Get a collection of product brands
593
+ def upload_asset_variation(data) #FIXME: Call to a member function guessClientExtension() on null
594
+ return @client.raw("post", "/content/assets/uploadVariation", nil, data)
595
+ end
596
+
597
+ def create_asset_size(data) #FIXME: Trying to get property 'path' of non-object
598
+ return @client.raw("post", "/content/assets/createSize", nil, data)
599
+ end
600
+
601
+ def update_asset_variation(id, data) #TODO:
602
+ return @client.raw("post", "/content/assets/updateVariation/#{id}", nil, data)
603
+ end
604
+
605
+ def get_asset_sizes(id) #FIXME: wrong number of arguments (given 1, expected 0)
606
+ return @client.raw("get", "/content/assets/sizes/#{id}")
607
+ end
608
+
609
+ def get_original_asset(id) #FIXME: Doesn't return JSON
610
+ return @client.raw("get", "/content/assets/original/#{id}")
611
+ end
612
+
613
+ def get_asset_variation(id)
614
+ #FIXME: Id 1 and 4: Trying to get property 'path' of non-object
615
+ #FIXME: Id 2 and 3: File not found at path maybe doesnt exist
616
+ return @client.raw("get", "/content/assets/variation/#{id}")
617
+ end
618
+
619
+ def get_asset_sizes(options)
620
+ return @client.raw("get", "/content/assets/getSizes", options)
621
+ end
622
+
623
+ def get_asset_usage(options)
624
+ return @client.raw("get", "/content/assets/usage", options)
625
+ end
626
+
627
+ def delete_asset_variation #TODO: Not tested
628
+ return @client.raw("get", "/content/assets/deleteVariation")
629
+ end
630
+
631
+ def delete_asset_size #TODO: Not tested
632
+ return @client.raw("get", "/content/assets/deleteSize")
633
+ end
634
+
635
+ def get_asset_info(options)
636
+ return @client.raw("get", "/content/assets/getAssetInfo", options)
637
+ end
638
+
639
+ def generate_asset_variation(data) #FIXME: Trying to get property 'width' of non-object
640
+ return @client.raw("post", "/content/assets/generateAssetVariations", nil, data)
641
+ end
642
+
643
+ def get_asset_doc_types
644
+ return @client.raw("get", "/content/assets/docTypes")
645
+ end
646
+
647
+ def get_asset_public_route
648
+ return @client.raw("get", "/content/assets/publicRoute")
649
+ end
650
+
651
+ ##
652
+ # == Story Template
328
653
  #
329
- # ==== Parameters
330
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
331
- def get_product_brands(options = nil)
332
- return @client.get__ecommerce__product_brands(options)
654
+
655
+ def get_support_data_of_story_template(id)
656
+ return @client.raw("get", "/content/story-templates/support-data/stories/#{id}")
657
+ end
658
+
659
+ def get_support_data_of_story_templates
660
+ return @client.raw("get", "/content/story-templates/support-data")
661
+ end
662
+
663
+ def get_story_templates(options = nil)
664
+ return @client.raw("get", "/content/story-templates", options)
333
665
  end
334
666
 
335
- def get_prodict_brand(id, options = nil)
336
- return @client.get__ecommerce__product_brands(id, options)
667
+ def get_story_template(id, options = nil)
668
+ return @client.raw("get", "/content/story-templates/#{id}", options)
337
669
  end
338
670
 
339
- def create_prodict_brand(data, options = nil)
340
- return @client.create__ecommerce__product_brands(data, options)
671
+ def create_story_template(data)
672
+ return @client.raw("post", "/content/story-templates", nil, data)
341
673
  end
342
674
 
343
- def update_product_brand(id, data, options = nil)
344
- return @client.update__ecommerce__product_brands(id, data, options)
675
+ def update_story_template(id, data) #FIXME: InternalServerError
676
+ return @client.raw("put", "/content/story-templates/#{id}", nil, data)
345
677
  end
346
678
 
347
- # === Get product types.
348
- # Get a collection of product types
679
+ ##
680
+ # == Story
349
681
  #
350
- # ==== Parameters
351
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
352
- def get_product_types(options = nil)
353
- return @client.get__ecommerce__product_types(options)
682
+
683
+ def publish_story(id, data) #FIXME: Invalid argument supplied for foreach()
684
+ return @client.raw("put", "/content/stories/#{id}/publish", nil, data)
685
+ end
686
+
687
+ def schedule_story(id, data) #FIXME: Invalid argument supplied for foreach()
688
+ return @client.raw("put", "/content/stories/#{id}/schedule", nil, data)
689
+ end
690
+
691
+ def revert_published_story(id)
692
+ return @client.raw("get", "/content/stories/#{id}/revert-published-data")
693
+ end
694
+
695
+ def get_story_support_data
696
+ return @client.raw("get", "/content/stories/support-data")
697
+ end
698
+
699
+ def duplicate_story(id, data)
700
+ return @client.raw("post", "/content/stories/#{id}/duplicate", nil, data)
701
+ end
702
+
703
+ def get_stories(options = nil)
704
+ return @client.raw("get", "/content/stories", options)
705
+ end
706
+
707
+ def get_story(id, options = nil)
708
+ return @client.raw("get", "/content/stories/#{id}", options)
354
709
  end
355
710
 
356
- def get_prodict_type(id, options = nil)
357
- return @client.get__ecommerce__product_types(id, options)
711
+ def create_story(data)
712
+ return @client.raw("post", "/content/stories", nil, data)
358
713
  end
359
714
 
360
- def create_prodict_type(data, options = nil)
361
- return @client.create__ecommerce__product_types(data, options)
715
+ def update_story(id, data) #FIXME: InternalServerError
716
+ return @client.raw("put", "/content/stories/#{id}", nil, data)
362
717
  end
363
718
 
364
- def update_product_type(id, data, options = nil)
365
- return @client.update__ecommerce__product_types(id, data, options)
719
+ def delete_story(id)
720
+ return @client.raw("delete", "/content/stories/#{id}")
366
721
  end
367
722
 
368
- # === Get product templates.
369
- # Get a collection of product templates
723
+ ##
724
+ # == Email Template
370
725
  #
371
- # ==== Parameters
372
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
373
- def get_product_templates(options = nil)
374
- return @client.get__ecommerce__product_templates(options)
726
+
727
+ def get_content_pages_from_email_template(id) #FIXME: ContentController doesnt have getContentPage method
728
+ return @client.raw("get", "/content/email-templates/content-pages/#{id}")
729
+ end
730
+
731
+ def get_variables_of_content_pages_from_email_template(id)
732
+ return @client.raw("get", "/content/email-templates/content-pages/#{id}/variables")
733
+ end
734
+
735
+ def get_recipient_variables
736
+ return @client.raw("get", "/content/email-templates/recipient-variables")
737
+ end
738
+
739
+ def get_driver_templates
740
+ return @client.raw("get", "/content/email-templates/driver/templates")
741
+ end
742
+
743
+ def preview_email_template(data)
744
+ return @client.raw("post", "/content/email-templates/preview", nil, data)
745
+ end
746
+
747
+ def send_email_template(data)
748
+ return @client.raw("post", "/content/email-templates/send", nil, data)
749
+ end
750
+
751
+ def duplicate_email_template(id, data)
752
+ return @client.raw("post", "/content/email-templates/#{id}/duplicate", nil, data)
375
753
  end
376
754
 
377
- def get_prodict_template(id, options = nil)
378
- return @client.get__ecommerce__product_templates(id, options)
755
+ def get_email_templates(options = nil)
756
+ return @client.raw("get", "/content/email-templates", options)
379
757
  end
380
758
 
381
- def create_prodict_template(data, options = nil)
382
- return @client.create__ecommerce__product_templates(data, options)
759
+ def get_email_template(id, options = nil)
760
+ return @client.raw("get", "/content/email-templates/#{id}", options)
383
761
  end
384
762
 
385
- def update_product_template(id, data, options = nil)
386
- return @client.update__ecommerce__product_templates(id, data, options)
763
+ def create_email_template(data)
764
+ return @client.raw("post", "/content/email-templates", nil, data)
387
765
  end
388
766
 
767
+ def update_email_template(id, data)
768
+ return @client.raw("put", "/content/email-templates/#{id}", nil, data)
769
+ end
770
+
771
+ def delete_email_template(id)
772
+ return @client.raw("delete", "/content/email-templates/#{id}")
773
+ end
389
774
 
390
- # === Get locations.
391
- # Get a collection of locations
775
+ ##
776
+ # == Keywords
392
777
  #
393
- # ==== Parameters
394
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
395
- def get_locations(options = nil)
396
- return @client.get__ecommerce__locations(options)
778
+
779
+ def get_keyword(id)
780
+ return @client.raw("get", "/content/keywords/#{id}")
781
+ end
782
+
783
+ def create_keyword(data)
784
+ return @client.raw("post", "/content/keywords", nil, data)
397
785
  end
398
786
 
399
- def get_location(id, options = nil)
400
- return @client.get__ecommerce__locations(id, options)
787
+ def update_keyword(id, data) #FIXME: Method doesn't work, controller cannot get keyword info from request variable.
788
+ return @client.raw("put", "/content/keywords/#{id}", nil, data)
401
789
  end
402
790
 
403
- def create_location(data, options = nil)
404
- return @client.create__ecommerce__locations(data, options)
791
+ ##
792
+ # == Authors
793
+ #
794
+
795
+ def get_author(id)
796
+ return @client.raw("get", "/content/authors/#{id}")
405
797
  end
406
798
 
407
- def update_location(id, data, options = nil)
408
- return @client.update__ecommerce__locations(id, data, options)
799
+ def create_author(data)
800
+ return @client.raw("post", "/content/authors", nil, data)
409
801
  end
410
-
411
- # === Get taxonomies.
412
- # Get a collection of taxonomies
802
+
803
+ def update_author(id, data) #FIXME: Method doesn't work, controller cannot get author data from request variable.
804
+ return @client.raw("put", "/content/authors/#{id}", nil, data)
805
+ end
806
+
807
+ ##
808
+ # == Stages
413
809
  #
414
- # ==== Parameters
415
- # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
416
- def get_taxonomies(options = nil)
417
- return @client.get__config__taxonomies(options)
810
+
811
+ def get_stage(id)
812
+ return @client.raw("get", "/content/stages/#{id}")
813
+ end
814
+
815
+ def create_stage(data) #FIXME: Cannot insert data into database successfully
816
+ return @client.raw("post", "/content/stages", nil, data)
817
+ end
818
+
819
+ def update_stage(id, data) #FIXME: Method doesn't work, controller cannot get stage data from request variable.
820
+ return @client.raw("put", "/content/stages/#{id}", nil, data)
821
+ end
822
+
823
+
824
+ ######################################### Marketing #########################################
825
+
826
+
827
+ ##
828
+ # == Automation
829
+ #
830
+
831
+ def get_automations(options = nil)
832
+ return @client.raw("get", "/marketing/automation", options)
833
+ end
834
+
835
+ def get_automation(id, options = nil)
836
+ return @client.raw("get", "/marketing/automation/#{id}", options)
837
+ end
838
+
839
+ def create_automation(data)
840
+ return @client.raw("post", "/marketing/automation/", nil, data)
841
+ end
842
+
843
+ def update_automation(id, data) #FIXME: Method doesn't work, controller cannot get automation data from request variable.
844
+ return @client.raw("put", "/marketing/automation/#{id}", nil, data)
845
+ end
846
+
847
+ def delete_automation(id)
848
+ return @client.raw("delete", "/marketing/automation/#{id}")
849
+ end
850
+
851
+ def get_automation_executions(id)
852
+ return @client.raw("get", "/marketing/automation/#{id}/executions")
853
+ end
854
+
855
+ def reset_automation(id)
856
+ return @client.raw("post", "/marketing/automation/#{id}/reset")
857
+ end
858
+
859
+ def duplicate_automation(id, data)
860
+ return @client.raw("post", "/marketing/automation/#{id}/duplicate", nil, data)
861
+ end
862
+
863
+
864
+ ######################################### Ecommerce #########################################
865
+
866
+
867
+ ##
868
+ # == Price List
869
+ #
870
+
871
+ def get_price_lists(options = nil)
872
+ return @client.raw("get", "/ecommerce/price-list", options)
873
+ end
874
+
875
+ def get_price_list(id, options = nil)
876
+ return @client.raw("get", "/ecommerce/price-list/#{id}", options)
877
+ end
878
+
879
+ def create_price_list(data)
880
+ return @client.raw("post", "/ecommerce/price-list", nil, data)
881
+ end
882
+
883
+ def update_price_list(id, data)
884
+ return @client.raw("put", "/ecommerce/price-list/#{id}", nil, data)
885
+ end
886
+
887
+ ##
888
+ # == Product
889
+ #
890
+
891
+ def update_product_variations_config(productId, data) #TODO: Research use
892
+ return @client.raw("post", "/ecommerce/products/update-variations-config/#{productId}", nil, data)
893
+ end
894
+
895
+ def get_product_support_data
896
+ return @client.raw("get", "/ecommerce/products/support-data")
897
+ end
898
+
899
+ def delete_product(id)
900
+ return @client.raw("delete", "/ecommerce/products/#{id}")
901
+ end
902
+
903
+ def publish_product(id, data) #TODO: Research data in publish
904
+ return @client.raw("put", "/ecommerce/products/#{id}/publish", nil, data)
905
+ end
906
+
907
+ def schedule_product(id, data)
908
+ return @client.raw("put", "/ecommerce/products/#{id}/schedule", nil, data)
909
+ end
910
+
911
+ def get_product_variant_options_config(id)
912
+ return @client.raw("get", "/ecommerce/products/#{id}/variant-options-config")
913
+ end
914
+
915
+ def revert_published_data(id)
916
+ return @client.raw("get", "/ecommerce/products/#{id}/revert-published-data")
917
+ end
918
+
919
+ def get_products(options = nil)
920
+ return @client.raw("get", "/ecommerce/products", options)
921
+ end
922
+
923
+ def get_product(id, options = nil)
924
+ return @client.raw("get", "/ecommerce/products/#{id}", options)
925
+ end
926
+
927
+ def create_product(data)
928
+ return @client.raw("post", "/ecommerce/products/", nil, data)
929
+ end
930
+
931
+ def update_product(id, data)
932
+ return @client.raw("put", "/ecommerce/products/#{id}", nil, data)
933
+ end
934
+
935
+ ##
936
+ # == Locations
937
+ #
938
+
939
+ def get_locations
940
+ return @client.raw("get", "/ecommerce/locations")
941
+ end
942
+
943
+ def get_location(id)
944
+ return @client.raw("get", "/ecommerce/locations/#{id}")
945
+ end
946
+
947
+ def create_location(data)
948
+ return @client.raw("post", "/ecommerce/locations", nil, data)
949
+ end
950
+
951
+ def update_location(id, data)
952
+ return @client.raw("put", "/ecommerce/locations/#{id}", nil, data)
418
953
  end
419
954
 
420
- def get_taxonomy(id, options = nil)
421
- return @client.get__config__taxonomies(id, options)
955
+ def delete_location(id)
956
+ return @client.raw("delete", "/ecommerce/locations/#{id}")
422
957
  end
423
958
 
424
- def create_taxonomy(data, options = nil)
425
- return @client.create__config__taxonomies(data, options)
959
+ ##
960
+ # == Locations Templates
961
+ #
962
+
963
+ def get_location_template_support_data(id)
964
+ return @client.raw("get", "/ecommerce/location-templates/#{id}/support-data")
965
+ end
966
+
967
+ def get_location_templates_support_data
968
+ return @client.raw("get", "/ecommerce/location-templates/support-data")
969
+ end
970
+
971
+ def get_location_templates(options = nil)
972
+ return @client.raw("get", "/ecommerce/location-templates", options)
426
973
  end
427
974
 
428
- def update_taxonomy(id, data, options = nil)
429
- return @client.update__config__taxonomies(id, data, options)
975
+ def get_location_template(id, options = nil)
976
+ return @client.raw("get", "/ecommerce/location-templates/#{id}", options)
977
+ end
978
+
979
+ def create_location_template(data)
980
+ return @client.raw("post", "/ecommerce/location-templates", nil, data)
430
981
  end
982
+
983
+ def update_location_template(id, data)
984
+ return @client.raw("put", "/ecommerce/location-templates/#{id}", nil, data)
985
+ end
986
+
431
987
  end
432
988
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mints
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruben Gomez Garcia, Omar Mora, Luis Payan, Oscar Castillo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-17 00:00:00.000000000 Z
11
+ date: 2021-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json