mints 0.0.2 → 0.0.7

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.
@@ -1,9 +1,35 @@
1
1
  require_relative './client.rb'
2
2
  module Mints
3
+ ##
4
+ # == User context API
5
+ # User class contains functions that needs an API key and a session token as authentication
6
+ # == Usage example
7
+ # Initialize
8
+ # client = Mints::User.new(mints_url, api_key)
9
+ # Call any function
10
+ # client.get_contacts
11
+ # == Single resource options
12
+ # * +include+ - [String] include a relationship
13
+ # * +attributes+ - [Boolean] attach attributes to response
14
+ # * +categories+ - [Boolean] attach categories to response
15
+ # * +tags+ - [Boolean] attach tags to response
16
+ # == Resource collections options
17
+ # * +search+ - [String] filter by a search word
18
+ # * +scopes+ - [String] filter by a scope
19
+ # * +filters+ - [String] filter by where clauses
20
+ # * +jfilters+ - [String] filter using complex condition objects
21
+ # * +catfilters+ - [String] filter by categories
22
+ # * +fields+ - [String] indicates the columns that will be selected
23
+ # * +sort+ - [String] indicates the columns that will be selected
24
+ # * +include+ - [String] include a relationship
25
+ # * +attributes+ - [Boolean] attach attributes to response
26
+ # * +categories+ - [Boolean] attach categories to response
27
+ # * +taxonomies+ - [Boolean] attach categories to response
28
+ # * +tags+ - [Boolean] attach tags to response
3
29
  class User
4
30
  attr_reader :client
5
- def initialize(host, api_key, session_token = nil)
6
- @client = Mints::Client.new(host, api_key, 'user', session_token)
31
+ def initialize(host, api_key, session_token = nil, debug = false)
32
+ @client = Mints::Client.new(host, api_key, 'user', session_token, debug)
7
33
  end
8
34
 
9
35
  def login(email, password)
@@ -18,7 +44,12 @@ module Mints
18
44
  return response
19
45
  end
20
46
  ######################################### CRM #########################################
21
- ### Contacts ###
47
+ ##
48
+ # === Get contacts.
49
+ # Get a collection of contacts
50
+ #
51
+ # ==== Parameters
52
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
22
53
  def get_contacts(options = nil)
23
54
  return @client.get__crm__contacts(options)
24
55
  end
@@ -34,7 +65,12 @@ module Mints
34
65
  def update_contact(id, data, options = nil)
35
66
  return @client.update__crm__contacts(id, data, options)
36
67
  end
37
- ### Companies ###
68
+
69
+ # === Get companies.
70
+ # Get a collection of companies
71
+ #
72
+ # ==== Parameters
73
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
38
74
  def get_companies(options = nil)
39
75
  return @client.get__crm__companies(options)
40
76
  end
@@ -51,7 +87,11 @@ module Mints
51
87
  return @client.update__crm__companies(id, data, options)
52
88
  end
53
89
 
54
- ### Deals ###
90
+ # === Get deals.
91
+ # Get a collection of deals
92
+ #
93
+ # ==== Parameters
94
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
55
95
  def get_deals(options = nil)
56
96
  return @client.get__crm__deals(options)
57
97
  end
@@ -69,7 +109,11 @@ module Mints
69
109
  end
70
110
 
71
111
  ######################################### Content #########################################
72
- ### Stories ###
112
+ # === Get stories.
113
+ # Get a collection of stories
114
+ #
115
+ # ==== Parameters
116
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
73
117
  def get_stories(options = nil)
74
118
  return @client.get__content__stories(options)
75
119
  end
@@ -86,7 +130,11 @@ module Mints
86
130
  return @client.update__content__stories(id, data, options)
87
131
  end
88
132
 
89
- ### Stories templates ###
133
+ # === Get story templates.
134
+ # Get a collection of story templates
135
+ #
136
+ # ==== Parameters
137
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
90
138
  def get_story_templates(options = nil)
91
139
  return @client.get__content__story_templates(options)
92
140
  end
@@ -103,7 +151,11 @@ module Mints
103
151
  return @client.update__content__story_templates(id, data, options)
104
152
  end
105
153
 
106
- ### Content instances ###
154
+ # === Get content instances.
155
+ # Get a collection of content instances
156
+ #
157
+ # ==== Parameters
158
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
107
159
  def get_content_instances(options = nil)
108
160
  return @client.get__content__instances(options)
109
161
  end
@@ -120,7 +172,11 @@ module Mints
120
172
  return @client.update__content__instances(id, data, options)
121
173
  end
122
174
 
123
- ### Content pages ###
175
+ # === Get content pages.
176
+ # Get a collection of content pages
177
+ #
178
+ # ==== Parameters
179
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
124
180
  def get_content_pages(options = nil)
125
181
  return @client.get__content__pages(options)
126
182
  end
@@ -137,25 +193,32 @@ module Mints
137
193
  return @client.update__content__pages(id, data, options)
138
194
  end
139
195
 
140
- ### Content templates ###
196
+ # === Get content templates.
197
+ # Get a collection of content templates
198
+ #
199
+ # ==== Parameters
200
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
141
201
  def get_content_templates(options = nil)
142
202
  return @client.get__content__templates(options)
143
203
  end
144
204
 
145
- def get_content_page(id, options = nil)
205
+ def get_content_template(id, options = nil)
146
206
  return @client.get__content__templates(id, options)
147
207
  end
148
208
 
149
- def create_content_page(data, options = nil)
209
+ def create_content_template(data, options = nil)
150
210
  return @client.create__content__templates(data, options)
151
211
  end
152
212
 
153
- def update_content_page(id, data, options = nil)
213
+ def update_content_template(id, data, options = nil)
154
214
  return @client.update__content__templates(id, data, options)
155
215
  end
156
216
 
157
- ######################################### Ecommerce #########################################
158
- ### Products ###
217
+ # === Get products.
218
+ # Get a collection of products
219
+ #
220
+ # ==== Parameters
221
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
159
222
  def get_products(options = nil)
160
223
  return @client.get__ecommerce__products(options)
161
224
  end
@@ -172,7 +235,11 @@ module Mints
172
235
  return @client.update__ecommerce__products(id, data, options)
173
236
  end
174
237
 
175
- ### SKUs ###
238
+ # === Get skus.
239
+ # Get a collection of skus
240
+ #
241
+ # ==== Parameters
242
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
176
243
  def get_skus(options = nil)
177
244
  return @client.get__ecommerce__skus(options)
178
245
  end
@@ -189,7 +256,11 @@ module Mints
189
256
  return @client.update__ecommerce__skus(id, data, options)
190
257
  end
191
258
 
192
- ### Prices ###
259
+ # === Get prices.
260
+ # Get a collection of prices
261
+ #
262
+ # ==== Parameters
263
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
193
264
  def get_prices(options = nil)
194
265
  return @client.get__ecommerce__prices(options)
195
266
  end
@@ -206,7 +277,11 @@ module Mints
206
277
  return @client.update__ecommerce__prices(id, data, options)
207
278
  end
208
279
 
209
- ### Price lists ###
280
+ # === Get prece lists.
281
+ # Get a collection of prece lists
282
+ #
283
+ # ==== Parameters
284
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
210
285
  def get_price_lists(options = nil)
211
286
  return @client.get__ecommerce__price_lists(options)
212
287
  end
@@ -223,7 +298,11 @@ module Mints
223
298
  return @client.update__ecommerce__price_lists(id, data, options)
224
299
  end
225
300
 
226
- ### Product brands ###
301
+ # === Get product brands.
302
+ # Get a collection of product brands
303
+ #
304
+ # ==== Parameters
305
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
227
306
  def get_product_brands(options = nil)
228
307
  return @client.get__ecommerce__product_brands(options)
229
308
  end
@@ -240,7 +319,11 @@ module Mints
240
319
  return @client.update__ecommerce__product_brands(id, data, options)
241
320
  end
242
321
 
243
- ### Product types ###
322
+ # === Get product types.
323
+ # Get a collection of product types
324
+ #
325
+ # ==== Parameters
326
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
244
327
  def get_product_types(options = nil)
245
328
  return @client.get__ecommerce__product_types(options)
246
329
  end
@@ -257,7 +340,11 @@ module Mints
257
340
  return @client.update__ecommerce__product_types(id, data, options)
258
341
  end
259
342
 
260
- ### Product templates ###
343
+ # === Get product templates.
344
+ # Get a collection of product templates
345
+ #
346
+ # ==== Parameters
347
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
261
348
  def get_product_templates(options = nil)
262
349
  return @client.get__ecommerce__product_templates(options)
263
350
  end
@@ -275,7 +362,11 @@ module Mints
275
362
  end
276
363
 
277
364
 
278
- ### Locations ###
365
+ # === Get locations.
366
+ # Get a collection of locations
367
+ #
368
+ # ==== Parameters
369
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
279
370
  def get_locations(options = nil)
280
371
  return @client.get__ecommerce__locations(options)
281
372
  end
@@ -291,5 +382,26 @@ module Mints
291
382
  def update_location(id, data, options = nil)
292
383
  return @client.update__ecommerce__locations(id, data, options)
293
384
  end
294
- end
385
+
386
+ # === Get taxonomies.
387
+ # Get a collection of taxonomies
388
+ #
389
+ # ==== Parameters
390
+ # * +options+ - [Hash] List of {Resource collection Options}[#class-Mints::User-label-Resource+collections+options+] shown above can be used as parameter
391
+ def get_taxonomies(options = nil)
392
+ return @client.get__config__taxonomies(options)
393
+ end
394
+
395
+ def get_taxonomy(id, options = nil)
396
+ return @client.get__config__taxonomies(id, options)
397
+ end
398
+
399
+ def create_taxonomy(data, options = nil)
400
+ return @client.create__config__taxonomies(data, options)
401
+ end
402
+
403
+ def update_taxonomy(id, data, options = nil)
404
+ return @client.update__config__taxonomies(id, data, options)
405
+ end
406
+ end
295
407
  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.2
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruben Gomez Garcia, Omar Mora
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-03 00:00:00.000000000 Z
11
+ date: 2020-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -70,6 +70,26 @@ dependencies:
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: 2.7.0
73
+ - !ruby/object:Gem::Dependency
74
+ name: rails-reverse-proxy
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: 0.9.1
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 0.9.1
83
+ type: :runtime
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.9.1
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 0.9.1
73
93
  description:
74
94
  email:
75
95
  executables: []
@@ -80,7 +100,17 @@ files:
80
100
  - Readme.md
81
101
  - lib/client.rb
82
102
  - lib/contact.rb
103
+ - lib/generators/mints_config.yml
104
+ - lib/generators/mints_contact_controller.rb
105
+ - lib/generators/mints_files_generator.rb
106
+ - lib/generators/mints_public_controller.rb
107
+ - lib/generators/mints_user_controller.rb
83
108
  - lib/mints.rb
109
+ - lib/mints/controllers/admin_base_controller.rb
110
+ - lib/mints/controllers/base_controller.rb
111
+ - lib/mints/controllers/contact_api_controller.rb
112
+ - lib/mints/controllers/public_api_controller.rb
113
+ - lib/mints/controllers/user_api_controller.rb
84
114
  - lib/pub.rb
85
115
  - lib/user.rb
86
116
  homepage: https://github.com/rubengomez/mints-ruby-sdk
@@ -89,6 +119,7 @@ metadata: {}
89
119
  post_install_message:
90
120
  rdoc_options: []
91
121
  require_paths:
122
+ - app
92
123
  - lib
93
124
  required_ruby_version: !ruby/object:Gem::Requirement
94
125
  requirements: