mints 0.0.16 → 0.0.20

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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/lib/client.rb +97 -38
  3. data/lib/contact.rb +124 -21
  4. data/lib/mints/controllers/admin_base_controller.rb +2 -2
  5. data/lib/mints/controllers/base_api_controller.rb +12 -11
  6. data/lib/mints/controllers/base_controller.rb +38 -9
  7. data/lib/mints_helper.rb +47 -0
  8. data/lib/pub.rb +147 -61
  9. data/lib/user/config/api_keys.rb +65 -0
  10. data/lib/user/config/appointments.rb +221 -0
  11. data/lib/user/config/attribute_groups.rb +77 -0
  12. data/lib/user/config/attributes.rb +86 -0
  13. data/lib/user/config/calendars.rb +89 -0
  14. data/lib/user/config/config.rb +65 -0
  15. data/lib/user/config/importers.rb +184 -0
  16. data/lib/user/config/public_folders.rb +108 -0
  17. data/lib/user/config/relationships.rb +138 -0
  18. data/lib/user/config/roles.rb +84 -0
  19. data/lib/user/config/seeds.rb +14 -0
  20. data/lib/user/config/system_settings.rb +53 -0
  21. data/lib/user/config/tags.rb +63 -0
  22. data/lib/user/config/taxonomies.rb +124 -0
  23. data/lib/user/config/teams.rb +70 -0
  24. data/lib/user/config/users.rb +76 -0
  25. data/lib/user/contacts/contacts.rb +21 -0
  26. data/lib/user/content/assets.rb +98 -0
  27. data/lib/user/content/content.rb +235 -0
  28. data/lib/user/content/content_instances.rb +147 -0
  29. data/lib/user/content/content_templates.rb +111 -0
  30. data/lib/user/content/conversations.rb +174 -0
  31. data/lib/user/content/dam.rb +88 -0
  32. data/lib/user/content/forms.rb +168 -0
  33. data/lib/user/content/message_templates.rb +162 -0
  34. data/lib/user/content/messages.rb +90 -0
  35. data/lib/user/content/pages.rb +81 -0
  36. data/lib/user/content/stories.rb +164 -0
  37. data/lib/user/content/story_templates.rb +95 -0
  38. data/lib/user/crm/companies.rb +111 -0
  39. data/lib/user/crm/contacts.rb +312 -0
  40. data/lib/user/crm/crm.rb +21 -0
  41. data/lib/user/crm/deals.rb +111 -0
  42. data/lib/user/crm/favorites.rb +17 -0
  43. data/lib/user/crm/segments.rb +132 -0
  44. data/lib/user/crm/users.rb +22 -0
  45. data/lib/user/crm/workflow_step_objects.rb +89 -0
  46. data/lib/user/crm/workflow_steps.rb +49 -0
  47. data/lib/user/crm/workflows.rb +70 -0
  48. data/lib/user/ecommerce/ecommerce.rb +29 -0
  49. data/lib/user/ecommerce/item_prices.rb +86 -0
  50. data/lib/user/ecommerce/locations.rb +166 -0
  51. data/lib/user/ecommerce/order_items_groups.rb +109 -0
  52. data/lib/user/ecommerce/order_statuses.rb +26 -0
  53. data/lib/user/ecommerce/orders.rb +258 -0
  54. data/lib/user/ecommerce/price_lists.rb +73 -0
  55. data/lib/user/ecommerce/product_templates.rb +104 -0
  56. data/lib/user/ecommerce/product_variations.rb +129 -0
  57. data/lib/user/ecommerce/products.rb +169 -0
  58. data/lib/user/ecommerce/skus.rb +88 -0
  59. data/lib/user/ecommerce/taxes.rb +82 -0
  60. data/lib/user/ecommerce/variant_options.rb +69 -0
  61. data/lib/user/ecommerce/variant_values.rb +72 -0
  62. data/lib/user/helpers/helpers.rb +113 -0
  63. data/lib/user/helpers/object_activities.rb +83 -0
  64. data/lib/user/helpers/object_folders.rb +82 -0
  65. data/lib/user/helpers/user_folders.rb +83 -0
  66. data/lib/user/marketing/marketing.rb +120 -0
  67. data/lib/user/profile/profile.rb +111 -0
  68. data/lib/user.rb +24 -368
  69. metadata +63 -3
@@ -0,0 +1,258 @@
1
+ module Orders
2
+ ##
3
+ # == Orders
4
+ #
5
+
6
+ # === Duplicate order.
7
+ # Duplicate an order.
8
+ #
9
+ # ==== Parameters
10
+ # orderId:: (Integer) -- Order id.
11
+ # data:: (Hash) -- Data to be submited.
12
+ #
13
+ def duplicate_order(orderId, data) #FIXME: Doesnt read options from data and sale_price_cents column doesnt have to be null
14
+ return @client.raw("post", "/ecommerce/orders/duplicate/#{orderId}", nil, data)
15
+ end
16
+
17
+ # === Delete orders.
18
+ # Delete orders.
19
+ #
20
+ # ==== Parameters
21
+ # data:: (Hash) -- Data to be submited.
22
+ #
23
+ # ==== Example
24
+ # data = {
25
+ # "ids": [ 18 ]
26
+ # }
27
+ # @data = @mints_user.delete_orders(data)
28
+ def delete_orders(data) #TODO: Inform method should return another response like 'success'
29
+ return @client.raw("delete", "/ecommerce/orders/delete", nil, data_transform(data))
30
+ end
31
+
32
+ # === Get orders support data.
33
+ # Get support data used in orders.
34
+ #
35
+ # ==== Example
36
+ # @data = @mints_user.get_orders_support_data
37
+ def get_orders_support_data
38
+ return @client.raw("get", "/ecommerce/orders/support-data")
39
+ end
40
+
41
+ # === Get orders.
42
+ # Get a collection of orders.
43
+ #
44
+ # ==== Parameters
45
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
46
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
47
+ #
48
+ # ==== First Example
49
+ # @data = @mints_user.get_orders
50
+ #
51
+ # ==== Second Example
52
+ # options = { "fields": "id, title" }
53
+ # @data = @mints_user.get_orders(options)
54
+ #
55
+ # ==== Third Example
56
+ # options = { "fields": "id, title" }
57
+ # @data = @mints_user.get_orders(options, false)
58
+ def get_orders(options = nil, use_post = true)
59
+ return get_query_results("/ecommerce/orders", options, use_post)
60
+ end
61
+
62
+ # === Get order.
63
+ # Get a order info.
64
+ #
65
+ # ==== Parameters
66
+ # id:: (Integer) -- Order id.
67
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
68
+ #
69
+ # ==== First Example
70
+ # @data = @mints_user.get_order(1)
71
+ #
72
+ # ==== Second Example
73
+ # options = { "fields": "title" }
74
+ # @data = @mints_user.get_order(1, options)
75
+ def get_order(id, options = nil)
76
+ return @client.raw("get", "/ecommerce/orders/#{id}", options)
77
+ end
78
+
79
+ # === Create order.
80
+ # Create a order with data.
81
+ #
82
+ # ==== Parameters
83
+ # data:: (Hash) -- Data to be submited.
84
+ #
85
+ # ==== Example
86
+ # data = {
87
+ # "title": "New Order",
88
+ # "order_template_id": 2
89
+ # }
90
+ # @data = @mints_user.create_order(data)
91
+ def create_order(data)
92
+ return @client.raw("post", "/ecommerce/orders", nil, data_transform(data))
93
+ end
94
+
95
+ # === Update order.
96
+ # Update a order info.
97
+ #
98
+ # ==== Parameters
99
+ # id:: (Integer) -- Order id.
100
+ # data:: (Hash) -- Data to be submited.
101
+ #
102
+ # ==== Example
103
+ # data = {
104
+ # "title": "New Order Modified"
105
+ # }
106
+ # @data = @mints_user.update_order(26, data)
107
+ def update_order(id, data)
108
+ return @client.raw("put", "/ecommerce/orders/#{id}", nil, data_transform(data))
109
+ end
110
+
111
+ ##
112
+ # == Order Templates
113
+ #
114
+
115
+ # === Get order template support data.
116
+ # Get support data from a order template.
117
+ #
118
+ # ==== Parameters
119
+ # id:: (Integer) -- Order template id.
120
+ #
121
+ # ==== Example
122
+ # @data = @mints_user.get_order_template_support_data(1)
123
+ def get_order_template_support_data(id)
124
+ return @client.raw("get", "/ecommerce/order-templates/support-data/#{id}")
125
+ end
126
+
127
+ # === Get order templates.
128
+ # Get a collection of order templates.
129
+ #
130
+ # ==== Parameters
131
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
132
+ #
133
+ # ==== First Example
134
+ # @data = @mints_user.get_order_templates
135
+ #
136
+ # ==== Second Example
137
+ # options = { "fields": "title" }
138
+ # @data = @mints_user.get_order_templates(options)
139
+ def get_order_templates(options = nil)
140
+ return @client.raw("get", "/ecommerce/order-templates", options)
141
+ end
142
+
143
+ # === Get order template.
144
+ # Get a order template info.
145
+ #
146
+ # ==== Parameters
147
+ # id:: (Integer) -- Order template id.
148
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
149
+ #
150
+ # ==== First Example
151
+ # @data = @mints_user.get_order_template(1)
152
+ #
153
+ # ==== Second Example
154
+ # options = { "fields": "title" }
155
+ # @data = @mints_user.get_order_template(1, options)
156
+ def get_order_template(id, options = nil)
157
+ return @client.raw("get", "/ecommerce/order-templates/#{id}", options)
158
+ end
159
+
160
+ # === Update order template.
161
+ # Update a order template info.
162
+ #
163
+ # ==== Parameters
164
+ # id:: (Integer) -- Order template id.
165
+ # data:: (Hash) -- Data to be submited.
166
+ #
167
+ # ==== Example
168
+ # data = {
169
+ # "title": "Inventory Increase"
170
+ # }
171
+ # @data = @mints_user.update_order_template(12, data)
172
+ def update_order_template(id, data)
173
+ return @client.raw("put", "/ecommerce/order-templates/#{id}", nil, data_transform(data))
174
+ end
175
+
176
+ ##
177
+ # == Order Items
178
+ #
179
+
180
+ # === Get order items support data.
181
+ # Get support data used in order items.
182
+ #
183
+ # ==== Example
184
+ # @data = @mints_user.get_order_items_support_data
185
+ def get_order_items_support_data
186
+ return @client.raw("get", "/ecommerce/order-items/support-data")
187
+ end
188
+
189
+ #TODO: The following two methods receive objects instead integer variable. Research use and test it.
190
+ # === Detach order item from order item group.
191
+ # Detach an order item from an order item group.
192
+ #
193
+ # ==== Parameters
194
+ # orderItemId:: (Integer) -- Order item id.
195
+ # groupId:: (Integer) -- Order items group id.
196
+ #
197
+ def detach_order_item_from_order_item_group(orderItemId, groupId) #TODO: Research use
198
+ return @client.raw("put", "/ecommerce/order-items/detach/#{orderItemId}/order-items-groups/#{groupId}")
199
+ end
200
+
201
+ # === Update order item from order item group.
202
+ # Update an order item data from an order item group.
203
+ #
204
+ # ==== Parameters
205
+ # orderItemId:: (Integer) -- Order item id.
206
+ # groupId:: (Integer) -- Order items group id.
207
+ #
208
+ def update_order_item_from_order_item_group(orderItemId, groupId, data) #TODO: Research use
209
+ return @client.raw("put", "/ecommerce/order-items/update/#{orderItemId}/order-items-groups/#{groupId}", nil, data_transform(data))
210
+ end
211
+
212
+ # === Get order items.
213
+ # Get a collection of order items.
214
+ #
215
+ # ==== Parameters
216
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
217
+ #
218
+ # ==== First Example
219
+ # @data = @mints_user.get_order_items
220
+ #
221
+ # ==== Second Example
222
+ # options = { "fields": "id" }
223
+ # @data = @mints_user.get_order_items(options)
224
+ def get_order_items(options = nil) #FIXME: CaliRouter POST method not supported.
225
+ return @client.raw("get", "/ecommerce/order-items", options)
226
+ end
227
+
228
+ # === Get order item.
229
+ # Get a order item info.
230
+ #
231
+ # ==== Parameters
232
+ # id:: (Integer) -- Order item id.
233
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
234
+ #
235
+ # ==== First Example
236
+ # @data = @mints_user.get_order_item(1)
237
+ #
238
+ # ==== Second Example
239
+ # options = { "fields": "id" }
240
+ # @data = @mints_user.get_order_item(1, options)
241
+ def get_order_item(id, options = nil)
242
+ return @client.raw("get", "/ecommerce/order-items/#{id}", options)
243
+ end
244
+
245
+ # === Update order item.
246
+ # Update a order item info.
247
+ #
248
+ # ==== Parameters
249
+ # id:: (Integer) -- Order item id.
250
+ # data:: (Hash) -- Data to be submited.
251
+ #
252
+ # ==== Example
253
+ # data = { "title": "No title in order items" }
254
+ # @data = @mints_user.update_order_item(1, data)
255
+ def update_order_item(id, data) #TODO: Research what can update
256
+ return @client.raw("put", "/ecommerce/order-items/#{id}", nil, data_transform(data))
257
+ end
258
+ end
@@ -0,0 +1,73 @@
1
+ module PriceList
2
+ ##
3
+ # == Price List
4
+ #
5
+
6
+ # === Get price lists.
7
+ # Get a collection of price lists.
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_price_lists
14
+ #
15
+ # ==== Second Example
16
+ # options = {
17
+ # "fields": "title"
18
+ # }
19
+ # @data = @mints_user.get_price_lists(options)
20
+ def get_price_lists(options = nil)
21
+ return get_query_results("/ecommerce/price-list", options)
22
+ end
23
+
24
+ # === Get price list.
25
+ # Get a price list info.
26
+ #
27
+ # ==== Parameters
28
+ # id:: (Integer) -- Price list id.
29
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
30
+ #
31
+ # ==== First Example
32
+ # @data = @mints_user.get_price_list(1)
33
+ #
34
+ # ==== Second Example
35
+ # options = {
36
+ # "fields": "title"
37
+ # }
38
+ # @data = @mints_user.get_price_list(1, options)
39
+ def get_price_list(id, options = nil)
40
+ return @client.raw("get", "/ecommerce/price-list/#{id}", options)
41
+ end
42
+
43
+ # === Create price list.
44
+ # Create a price list with data.
45
+ #
46
+ # ==== Parameters
47
+ # data:: (Hash) -- Data to be submited.
48
+ #
49
+ # ==== Example
50
+ # data = {
51
+ # "title": "New Price List"
52
+ # }
53
+ # @data = @mints_user.create_price_list(data)
54
+ def create_price_list(data)
55
+ return @client.raw("post", "/ecommerce/price-list", nil, data_transform(data))
56
+ end
57
+
58
+ # === Update price list.
59
+ # Update a price list info.
60
+ #
61
+ # ==== Parameters
62
+ # id:: (Integer) -- Price list id.
63
+ # data:: (Hash) -- Data to be submited.
64
+ #
65
+ # ==== Example
66
+ # data = {
67
+ # "title": "New Price List Modified"
68
+ # }
69
+ # @data = @mints_user.update_price_list(8, data)
70
+ def update_price_list(id, data)
71
+ return @client.raw("put", "/ecommerce/price-list/#{id}", nil, data_transform(data))
72
+ end
73
+ end
@@ -0,0 +1,104 @@
1
+ module ProductTemplates
2
+ ##
3
+ # == Product Templates
4
+ #
5
+
6
+ # === Get product templates support data from product.
7
+ # Get product templates support data from a product.
8
+ #
9
+ # ==== Parameters
10
+ # id:: (Integer) -- Product id.
11
+ #
12
+ # ==== Example
13
+ # @data = @mints_user.get_product_templates_support_data_from_product(1)
14
+ def get_product_templates_support_data_from_product(id)
15
+ return @client.raw("get", "/ecommerce/product-templates/support-data/products/#{id}")
16
+ end
17
+
18
+ # === Get product templates support data from order items group.
19
+ # Get product templates support data from a order items group.
20
+ #
21
+ # ==== Parameters
22
+ # id:: (Integer) -- Order items group id.
23
+ #
24
+ # ==== Example
25
+ # @data = @mints_user.get_product_templates_support_data_from_order_items_group(1)
26
+ def get_product_templates_support_data_from_order_items_group(id)
27
+ return @client.raw("get", "/ecommerce/product-templates/support-data/order-items-groups/#{id}")
28
+ end
29
+
30
+ # === Get product templates support data.
31
+ # Get support data used in product templates.
32
+ #
33
+ # ==== Example
34
+ # @data = @mints_user.get_product_templates_support_data
35
+ def get_product_templates_support_data
36
+ return @client.raw("get", "/ecommerce/product-templates/support-data")
37
+ end
38
+
39
+ # === Get product templates.
40
+ # Get a collection of product templates.
41
+ #
42
+ # ==== Parameters
43
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
44
+ #
45
+ # ==== First Example
46
+ # @data = @mints_user.get_product_templates
47
+ #
48
+ # ==== Second Example
49
+ # options = { "fields": "title" }
50
+ # @data = @mints_user.get_product_templates(options)
51
+ def get_product_templates(options = nil)
52
+ return @client.raw("get", "/ecommerce/product-templates", options)
53
+ end
54
+
55
+ # === Get product template.
56
+ # Get a product template info.
57
+ #
58
+ # ==== Parameters
59
+ # id:: (Integer) -- Product template id.
60
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
61
+ #
62
+ # ==== First Example
63
+ # @data = @mints_user.get_product_template(1)
64
+ #
65
+ # ==== Second Example
66
+ # options = { "fields": "title" }
67
+ # @data = @mints_user.get_product_template(1, options)
68
+ def get_product_template(id, options = nil)
69
+ return @client.raw("get", "/ecommerce/product-templates/#{id}", options)
70
+ end
71
+
72
+ # === Create product template.
73
+ # Create a product template with data.
74
+ #
75
+ # ==== Parameters
76
+ # data:: (Hash) -- Data to be submited.
77
+ #
78
+ # ==== Example
79
+ # data = {
80
+ # "title": "New Product Template",
81
+ # "slug": "new-product-template"
82
+ # }
83
+ # @data = @mints_user.create_product_template(data)
84
+ def create_product_template(data)
85
+ return @client.raw("post", "/ecommerce/product-templates/", nil, data_transform(data))
86
+ end
87
+
88
+ # === Update product template.
89
+ # Update a product template info.
90
+ #
91
+ # ==== Parameters
92
+ # id:: (Integer) -- Product template id.
93
+ # data:: (Hash) -- Data to be submited.
94
+ #
95
+ # ==== Example
96
+ # data = {
97
+ # "title": "New Product Template Modified",
98
+ # "slug": "new-product-template"
99
+ # }
100
+ # @data = @mints_user.update_product_template(3, data)
101
+ def update_product_template(id, data)
102
+ return @client.raw("put", "/ecommerce/product-templates/#{id}", nil, data_transform(data))
103
+ end
104
+ end
@@ -0,0 +1,129 @@
1
+ module ProductVariations
2
+ ##
3
+ # == Product Variation
4
+ #
5
+
6
+ # === Generate product variation.
7
+ # Generate a product variation.
8
+ #
9
+ # ==== Parameters
10
+ # productId:: (Integer) -- Product id.
11
+ # data:: (Hash) -- Data to be submited.
12
+ #
13
+ def generate_product_variation(productId, data) #TODO: Research use
14
+ #TODO: Notify line 247 had a '/' before Exception
15
+ return @client.raw("post", "/ecommerce/product-variations/generate/#{productId}", nil, data_transform(data))
16
+ end
17
+
18
+ # === Set prices to product variations.
19
+ # Set prices to product variations.
20
+ #
21
+ # ==== Parameters
22
+ # data:: (Hash) -- Data to be submited.
23
+ #
24
+ # ==== Example
25
+ # skus = [
26
+ # { "id": 100 }
27
+ # ]
28
+ # prices = [
29
+ # { "id": 1, "value": 1259 },
30
+ # { "id": 2, "value": 1260 }
31
+ # ]
32
+ # data = {
33
+ # "skus": skus.to_json,
34
+ # "prices": prices.to_json
35
+ # }
36
+ # @data = @mints_user.set_prices_to_product_variations(data)
37
+ def set_prices_to_product_variations(data)
38
+ return @client.raw("post", "/ecommerce/product-variations/set-prices", nil, data_transform(data))
39
+ end
40
+
41
+ # === Get product from product variation.
42
+ # Get a product from a product variation.
43
+ #
44
+ # ==== Parameters
45
+ # productId:: (Integer) -- Product id.
46
+ #
47
+ # ==== Example
48
+ # @data = @mints_user.get_product_from_product_variation(1)
49
+ def get_product_from_product_variation(productId)
50
+ return @client.raw("get", "/ecommerce/product-variations/product/#{productId}")
51
+ end
52
+
53
+ # === Get product variations.
54
+ # Get a collection of product variations.
55
+ #
56
+ # ==== Parameters
57
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
58
+ #
59
+ # ==== Example
60
+ # @data = @mints_user.get_product_variations
61
+ def get_product_variations
62
+ return @client.raw("get", "/ecommerce/product-variations")
63
+ end
64
+
65
+ # === Get product variation.
66
+ # Get a product variation info.
67
+ #
68
+ # ==== Parameters
69
+ # id:: (Integer) -- Product variation id.
70
+ #
71
+ # ==== Example
72
+ # @data = @mints_user.get_product_variation(100)
73
+ def get_product_variation(id)
74
+ return @client.raw("get", "/ecommerce/product-variations/#{id}")
75
+ end
76
+
77
+ # === Create product variation.
78
+ # Create a product variation with data.
79
+ #
80
+ # ==== Parameters
81
+ # data:: (Hash) -- Data to be submited.
82
+ #
83
+ # ==== Example
84
+ # data = {
85
+ # "title": "New Product Variation",
86
+ # "sku": "NEW-PRODUCT-VARIATION-SKU",
87
+ # "product_id": 5,
88
+ # "supplier": 36,
89
+ # "prices": [
90
+ # { "id": 1, "value": 300 }
91
+ # ]
92
+ # }
93
+ # @data = @mints_user.create_product_variation(data)
94
+ def create_product_variation(data)
95
+ return @client.raw("post", "/ecommerce/product-variations", nil, data_transform(data))
96
+ end
97
+
98
+ # === Update product variation.
99
+ # Update a product variation info.
100
+ #
101
+ # ==== Parameters
102
+ # id:: (Integer) -- Product variation id.
103
+ # data:: (Hash) -- Data to be submited.
104
+ #
105
+ # ==== Example
106
+ # data = {
107
+ # "title": "New Product Variation Modified",
108
+ # "cost": 123,
109
+ # "prices": [
110
+ # { "id": 1, "value": 400 }
111
+ # ]
112
+ # }
113
+ # @data = @mints_user.update_product_variation(528, data)
114
+ def update_product_variation(id, data)
115
+ return @client.raw("put", "/ecommerce/product-variations/#{id}", nil, data_transform(data))
116
+ end
117
+
118
+ # === Delete product variation.
119
+ # Delete a product variation.
120
+ #
121
+ # ==== Parameters
122
+ # id:: (Integer) -- Product variation id.
123
+ #
124
+ # ==== Example
125
+ # @data = @mints_user.delete_product_variation(528)
126
+ def delete_product_variation(id)
127
+ return @client.raw("delete", "/ecommerce/product-variations/#{id}")
128
+ end
129
+ end