mints 0.0.27 → 0.0.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/lib/client.rb +287 -385
  4. data/lib/contact/config/appointments.rb +201 -0
  5. data/lib/contact/config/config.rb +7 -0
  6. data/lib/contact/content/content.rb +7 -0
  7. data/lib/contact/content/conversations.rb +121 -0
  8. data/lib/contact/ecommerce/ecommerce.rb +12 -0
  9. data/lib/contact/ecommerce/order_items.rb +19 -0
  10. data/lib/contact/ecommerce/order_items_groups.rb +95 -0
  11. data/lib/contact/ecommerce/orders.rb +133 -0
  12. data/lib/contact.rb +57 -607
  13. data/lib/errors.rb +4 -2
  14. data/lib/generators/mints_assets_controller.rb +4 -1
  15. data/lib/generators/mints_config.yml.erb +0 -2
  16. data/lib/generators/mints_contact_controller.rb +4 -1
  17. data/lib/generators/mints_files_generator.rb +16 -13
  18. data/lib/generators/mints_link.rb +9 -6
  19. data/lib/generators/mints_public_controller.rb +4 -1
  20. data/lib/generators/mints_user_controller.rb +3 -0
  21. data/lib/generators/short_link_controller.rb +4 -1
  22. data/lib/mints/controllers/admin_base_controller.rb +5 -3
  23. data/lib/mints/controllers/base_api_controller.rb +6 -4
  24. data/lib/mints/controllers/base_controller.rb +5 -3
  25. data/lib/mints/controllers/concerns/mints_clients.rb +4 -2
  26. data/lib/mints/controllers/concerns/read_config_file.rb +3 -1
  27. data/lib/mints/controllers/contact_api_controller.rb +12 -10
  28. data/lib/mints/controllers/public_api_controller.rb +10 -8
  29. data/lib/mints/controllers/user_api_controller.rb +11 -9
  30. data/lib/mints/helpers/contact_auth_helper.rb +3 -1
  31. data/lib/mints/helpers/mints_helper.rb +39 -38
  32. data/lib/mints/helpers/proxy_controllers_methods.rb +24 -24
  33. data/lib/mints/helpers/user_auth_helper.rb +5 -3
  34. data/lib/mints.rb +12 -10
  35. data/lib/pub.rb +75 -93
  36. data/lib/user/config/api_keys.rb +63 -61
  37. data/lib/user/config/appointments.rb +217 -215
  38. data/lib/user/config/attribute_groups.rb +74 -72
  39. data/lib/user/config/attributes.rb +83 -81
  40. data/lib/user/config/calendars.rb +88 -86
  41. data/lib/user/config/config.rb +31 -63
  42. data/lib/user/config/public_folders.rb +105 -104
  43. data/lib/user/config/relationships.rb +135 -132
  44. data/lib/user/config/roles.rb +76 -79
  45. data/lib/user/config/seeds.rb +52 -51
  46. data/lib/user/config/system_settings.rb +50 -49
  47. data/lib/user/config/tags.rb +57 -59
  48. data/lib/user/config/taxonomies.rb +115 -119
  49. data/lib/user/config/teams.rb +69 -68
  50. data/lib/user/config/users.rb +72 -71
  51. data/lib/user/contacts/contacts.rb +21 -20
  52. data/lib/user/content/assets.rb +275 -280
  53. data/lib/user/content/content.rb +236 -235
  54. data/lib/user/content/content_instances.rb +138 -138
  55. data/lib/user/content/content_templates.rb +105 -103
  56. data/lib/user/content/conversations.rb +195 -193
  57. data/lib/user/content/dam.rb +85 -80
  58. data/lib/user/content/forms.rb +231 -233
  59. data/lib/user/content/message_templates.rb +154 -151
  60. data/lib/user/content/messages.rb +89 -87
  61. data/lib/user/content/pages.rb +84 -82
  62. data/lib/user/content/stories.rb +101 -101
  63. data/lib/user/content/story_templates.rb +90 -88
  64. data/lib/user/content/story_versions.rb +117 -117
  65. data/lib/user/crm/companies.rb +106 -106
  66. data/lib/user/crm/contacts.rb +287 -292
  67. data/lib/user/crm/crm.rb +21 -19
  68. data/lib/user/crm/deals.rb +105 -103
  69. data/lib/user/crm/favorites.rb +16 -13
  70. data/lib/user/crm/segments.rb +123 -123
  71. data/lib/user/crm/users.rb +22 -20
  72. data/lib/user/crm/workflow_step_objects.rb +86 -84
  73. data/lib/user/crm/workflow_steps.rb +47 -45
  74. data/lib/user/crm/workflows.rb +67 -65
  75. data/lib/user/ecommerce/ecommerce.rb +29 -27
  76. data/lib/user/ecommerce/item_prices.rb +84 -81
  77. data/lib/user/ecommerce/locations.rb +162 -160
  78. data/lib/user/ecommerce/order_items_groups.rb +110 -106
  79. data/lib/user/ecommerce/order_statuses.rb +26 -24
  80. data/lib/user/ecommerce/orders.rb +253 -246
  81. data/lib/user/ecommerce/price_lists.rb +70 -68
  82. data/lib/user/ecommerce/product_templates.rb +101 -99
  83. data/lib/user/ecommerce/product_variations.rb +124 -120
  84. data/lib/user/ecommerce/products.rb +162 -159
  85. data/lib/user/ecommerce/skus.rb +87 -85
  86. data/lib/user/ecommerce/taxes.rb +81 -79
  87. data/lib/user/ecommerce/variant_options.rb +68 -66
  88. data/lib/user/ecommerce/variant_values.rb +71 -69
  89. data/lib/user/helpers/helpers.rb +104 -101
  90. data/lib/user/helpers/object_activities.rb +80 -78
  91. data/lib/user/helpers/object_folders.rb +78 -76
  92. data/lib/user/helpers/user_folders.rb +79 -77
  93. data/lib/user/marketing/marketing.rb +116 -113
  94. data/lib/user/profile/profile.rb +96 -103
  95. data/lib/user.rb +32 -41
  96. metadata +50 -43
  97. data/lib/user/config/importers.rb +0 -184
@@ -1,169 +1,172 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Products
2
- ##
3
- # == Product
4
- #
4
+ ##
5
+ # == Product
6
+ #
7
+
8
+ # === Update product variations config.
9
+ # Update config of product variations of a product.
10
+ #
11
+ # ==== Parameters
12
+ # product_id:: (Integer) -- Product id.
13
+ # data:: (Hash) -- Data to be submitted.
14
+ #
15
+ def update_product_variations_config(product_id, data)
16
+ # TODO: Method doesnt work, research use
17
+ @client.raw('post', "/ecommerce/products/update-variations-config/#{product_id}", nil, data_transform(data))
18
+ end
19
+
20
+ # === Get product support data.
21
+ # Get support data used in products.
22
+ #
23
+ # ==== Example
24
+ # @data = @mints_user.get_products_support_data
25
+ def get_products_support_data
26
+ @client.raw('get', '/ecommerce/products/support-data')
27
+ end
5
28
 
6
- # === Update product variations config.
7
- # Update config of product variations of a product.
8
- #
9
- # ==== Parameters
10
- # productId:: (Integer) -- Product id.
11
- # data:: (Hash) -- Data to be submitted.
12
- #
13
- def update_product_variations_config(productId, data) #TODO: Method doesnt work, research use
14
- @client.raw("post", "/ecommerce/products/update-variations-config/#{productId}", nil, data_transform(data))
15
- end
29
+ # === Delete product.
30
+ # Delete a product.
31
+ #
32
+ # ==== Parameters
33
+ # id:: (Integer) -- Product id.
34
+ #
35
+ def delete_product(id)
36
+ @client.raw('delete', "/ecommerce/products/#{id}")
37
+ end
16
38
 
17
- # === Get product support data.
18
- # Get support data used in products.
19
- #
20
- # ==== Example
21
- # @data = @mints_user.get_products_support_data
22
- def get_products_support_data
23
- @client.raw("get", "/ecommerce/products/support-data")
24
- end
39
+ # === Publish product.
40
+ # Publish a product.
41
+ #
42
+ # ==== Parameters
43
+ # id:: (Integer) -- Product id.
44
+ # data:: (Hash) -- Data to be submitted.
45
+ #
46
+ # ==== Example
47
+ # data = {
48
+ # title: 'New Publish'
49
+ # }
50
+ # @data = @mints_user.publish_product(2, data)
51
+ def publish_product(id, data)
52
+ @client.raw('put', "/ecommerce/products/#{id}/publish", nil, data_transform(data))
53
+ end
25
54
 
26
- # === Delete product.
27
- # Delete a product.
28
- #
29
- # ==== Parameters
30
- # id:: (Integer) -- Product id.
31
- #
32
- def delete_product(id)
33
- @client.raw("delete", "/ecommerce/products/#{id}")
34
- end
35
-
36
- # === Publish product.
37
- # Publish a product.
38
- #
39
- # ==== Parameters
40
- # id:: (Integer) -- Product id.
41
- # data:: (Hash) -- Data to be submitted.
42
- #
43
- # ==== Example
44
- # data = {
45
- # "title": "New Publish"
46
- # }
47
- # @data = @mints_user.publish_product(2, data)
48
- def publish_product(id, data)
49
- @client.raw("put", "/ecommerce/products/#{id}/publish", nil, data_transform(data))
50
- end
55
+ # === Schedule product.
56
+ # Schedule a product.
57
+ #
58
+ # ==== Parameters
59
+ # id:: (Integer) -- Product id.
60
+ # data:: (Hash) -- Data to be submitted.
61
+ #
62
+ # ==== Example
63
+ # data = {
64
+ # scheduled_at: '1970-01-01 00:00:00'
65
+ # }
66
+ # @data = @mints_user.schedule_product(2, data)
67
+ def schedule_product(id, data)
68
+ @client.raw('put', "/ecommerce/products/#{id}/schedule", nil, data_transform(data))
69
+ end
51
70
 
52
- # === Schedule product.
53
- # Schedule a product.
54
- #
55
- # ==== Parameters
56
- # id:: (Integer) -- Product id.
57
- # data:: (Hash) -- Data to be submitted.
58
- #
59
- # ==== Example
60
- # data = {
61
- # "scheduled_at": "1970-01-01 00:00:00"
62
- # }
63
- # @data = @mints_user.schedule_product(2, data)
64
- def schedule_product(id, data)
65
- @client.raw("put", "/ecommerce/products/#{id}/schedule", nil, data_transform(data))
66
- end
71
+ # === Get product variant options config.
72
+ # Get variant options config used in a product.
73
+ #
74
+ # ==== Parameters
75
+ # id:: (Integer) -- Product id.
76
+ #
77
+ # ==== Example
78
+ # @data = @mints_user.get_product_variant_options_config(1)
79
+ def get_product_variant_options_config(id)
80
+ @client.raw('get', "/ecommerce/products/#{id}/variant-options-config")
81
+ end
67
82
 
68
- # === Get product variant options config.
69
- # Get variant options config used in a product.
70
- #
71
- # ==== Parameters
72
- # id:: (Integer) -- Product id.
73
- #
74
- # ==== Example
75
- # @data = @mints_user.get_product_variant_options_config(1)
76
- def get_product_variant_options_config(id)
77
- @client.raw("get", "/ecommerce/products/#{id}/variant-options-config")
78
- end
83
+ # === Revert published product.
84
+ # Revert a published product.
85
+ #
86
+ # ==== Parameters
87
+ # id:: (Integer) -- Product id.
88
+ #
89
+ # ==== Example
90
+ # @data = @mints_user.revert_published_product(2)
91
+ def revert_published_product(id)
92
+ @client.raw('get', "/ecommerce/products/#{id}/revert-published-data")
93
+ end
79
94
 
80
- # === Revert published product.
81
- # Revert a published product.
82
- #
83
- # ==== Parameters
84
- # id:: (Integer) -- Product id.
85
- #
86
- # ==== Example
87
- # @data = @mints_user.revert_published_product(2)
88
- def revert_published_product(id)
89
- @client.raw("get", "/ecommerce/products/#{id}/revert-published-data")
90
- end
91
-
92
- # === Get products.
93
- # Get a collection of products.
94
- #
95
- # ==== Parameters
96
- # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
97
- # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
98
- #
99
- # ==== First Example
100
- # @data = @mints_user.get_products
101
- #
102
- # ==== Second Example
103
- # options = {
104
- # "fields": "id"
105
- # }
106
- # @data = @mints_user.get_products(options)
107
- #
108
- # ==== Third Example
109
- # options = {
110
- # "fields": "id"
111
- # }
112
- # @data = @mints_user.get_products(options, false)
113
- def get_products(options = nil, use_post = true)
114
- return get_query_results("/ecommerce/products", options, use_post)
115
- end
95
+ # === Get products.
96
+ # Get a collection of products.
97
+ #
98
+ # ==== Parameters
99
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
100
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
101
+ #
102
+ # ==== First Example
103
+ # @data = @mints_user.get_products
104
+ #
105
+ # ==== Second Example
106
+ # options = {
107
+ # fields: 'id'
108
+ # }
109
+ # @data = @mints_user.get_products(options)
110
+ #
111
+ # ==== Third Example
112
+ # options = {
113
+ # fields: 'id'
114
+ # }
115
+ # @data = @mints_user.get_products(options, false)
116
+ def get_products(options = nil, use_post = true)
117
+ get_query_results('/ecommerce/products', options, use_post)
118
+ end
116
119
 
117
- # === Get product.
118
- # Get a product info.
119
- #
120
- # ==== Parameters
121
- # id:: (Integer) -- Product id.
122
- # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
123
- #
124
- # ==== First Example
125
- # @data = @mints_user.get_product(3)
126
- #
127
- # ==== Second Example
128
- # options = {
129
- # "fields": "slug"
130
- # }
131
- # @data = @mints_user.get_product(3, options)
132
- def get_product(id, options = nil)
133
- @client.raw("get", "/ecommerce/products/#{id}", options)
134
- end
120
+ # === Get product.
121
+ # Get a product info.
122
+ #
123
+ # ==== Parameters
124
+ # id:: (Integer) -- Product id.
125
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
126
+ #
127
+ # ==== First Example
128
+ # @data = @mints_user.get_product(3)
129
+ #
130
+ # ==== Second Example
131
+ # options = {
132
+ # fields: "slug"
133
+ # }
134
+ # @data = @mints_user.get_product(3, options)
135
+ def get_product(id, options = nil)
136
+ @client.raw('get', "/ecommerce/products/#{id}", options)
137
+ end
135
138
 
136
- # === Create product.
137
- # Create a product with data.
138
- #
139
- # ==== Parameters
140
- # data:: (Hash) -- Data to be submitted.
141
- #
142
- # ==== Example
143
- # data = {
144
- # "title": "New Product",
145
- # "slug": "new-product",
146
- # "sku_prefix": "sku_prefix"
147
- # }
148
- # @data = @mints_user.create_product(data)
149
- def create_product(data, options = nil)
150
- @client.raw("post", "/ecommerce/products/", options, data_transform(data))
151
- end
139
+ # === Create product.
140
+ # Create a product with data.
141
+ #
142
+ # ==== Parameters
143
+ # data:: (Hash) -- Data to be submitted.
144
+ #
145
+ # ==== Example
146
+ # data = {
147
+ # title: 'New Product',
148
+ # slug: 'new-product',
149
+ # sku_prefix: 'sku_prefix'
150
+ # }
151
+ # @data = @mints_user.create_product(data)
152
+ def create_product(data, options = nil)
153
+ @client.raw('post', '/ecommerce/products/', options, data_transform(data))
154
+ end
152
155
 
153
- # === Update product.
154
- # Update a product info.
155
- #
156
- # ==== Parameters
157
- # id:: (Integer) -- Product id.
158
- # data:: (Hash) -- Data to be submitted.
159
- #
160
- # ==== Example
161
- # data = {
162
- # "title": "New Product Modified",
163
- # "slug": "new-product"
164
- # }
165
- # @data = @mints_user.update_product(9, data)
166
- def update_product(id, data, options = nil)
167
- @client.raw("put", "/ecommerce/products/#{id}", options, data_transform(data))
168
- end
169
- end
156
+ # === Update product.
157
+ # Update a product info.
158
+ #
159
+ # ==== Parameters
160
+ # id:: (Integer) -- Product id.
161
+ # data:: (Hash) -- Data to be submitted.
162
+ #
163
+ # ==== Example
164
+ # data = {
165
+ # title: 'New Product Modified',
166
+ # slug: 'new-product'
167
+ # }
168
+ # @data = @mints_user.update_product(9, data)
169
+ def update_product(id, data, options = nil)
170
+ @client.raw('put', "/ecommerce/products/#{id}", options, data_transform(data))
171
+ end
172
+ end
@@ -1,88 +1,90 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Skus
2
- ##
3
- # == Sku
4
- #
4
+ ##
5
+ # == Sku
6
+ #
7
+
8
+ # === Get skus.
9
+ # Get a collection of skus.
10
+ #
11
+ # ==== Parameters
12
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
13
+ #
14
+ # ==== First Example
15
+ # @data = @mints_user.get_skus
16
+ #
17
+ # ==== Second Example
18
+ # options = {
19
+ # fields: 'sku'
20
+ # }
21
+ # @data = @mints_user.get_skus(options)
22
+ def get_skus(options = nil)
23
+ @client.raw('get', '/ecommerce/skus', options)
24
+ end
25
+
26
+ # === Get sku.
27
+ # Get a sku info.
28
+ #
29
+ # ==== Parameters
30
+ # id:: (Integer) -- Sku id.
31
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
32
+ #
33
+ # ==== First Example
34
+ # @data = @mints_user.get_sku(1)
35
+ #
36
+ # ==== Second Example
37
+ # options = {
38
+ # fields: 'title, sku'
39
+ # }
40
+ # @data = @mints_user.get_sku(1, options)
41
+ def get_sku(id, options = nil)
42
+ @client.raw('get', "/ecommerce/skus/#{id}", options)
43
+ end
44
+
45
+ # === Create sku.
46
+ # Create a sku with data.
47
+ #
48
+ # ==== Parameters
49
+ # data:: (Hash) -- Data to be submitted.
50
+ #
51
+ # ==== Example
52
+ # data = {
53
+ # sku: 'NEW-SKU',
54
+ # title: 'New Sku',
55
+ # slug: 'new-sku',
56
+ # product_id: 1
57
+ # }
58
+ # @data = @mints_user.create_sku(data)
59
+ def create_sku(data)
60
+ @client.raw('post', '/ecommerce/skus', nil, data_transform(data))
61
+ end
5
62
 
6
- # === Get skus.
7
- # Get a collection of skus.
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_skus
14
- #
15
- # ==== Second Example
16
- # options = {
17
- # "fields": "sku"
18
- # }
19
- # @data = @mints_user.get_skus(options)
20
- def get_skus(options = nil)
21
- @client.raw("get", "/ecommerce/skus", options)
22
- end
23
-
24
- # === Get sku.
25
- # Get a sku info.
26
- #
27
- # ==== Parameters
28
- # id:: (Integer) -- Sku 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_sku(1)
33
- #
34
- # ==== Second Example
35
- # options = {
36
- # "fields": "title, sku"
37
- # }
38
- # @data = @mints_user.get_sku(1, options)
39
- def get_sku(id, options = nil)
40
- @client.raw("get", "/ecommerce/skus/#{id}", options)
41
- end
63
+ # === Update sku.
64
+ # Update a sku info.
65
+ #
66
+ # ==== Parameters
67
+ # id:: (Integer) -- Sku id.
68
+ # data:: (Hash) -- Data to be submitted.
69
+ #
70
+ # ==== Example
71
+ # data = {
72
+ # sku: 'NEW-SKU-XXXIX'
73
+ # }
74
+ # @data = @mints_user.update_sku(531, data)
75
+ def update_sku(id, data)
76
+ @client.raw('put', "/ecommerce/skus/#{id}", nil, data_transform(data))
77
+ end
42
78
 
43
- # === Create sku.
44
- # Create a sku with data.
45
- #
46
- # ==== Parameters
47
- # data:: (Hash) -- Data to be submitted.
48
- #
49
- # ==== Example
50
- # data = {
51
- # "sku": "NEW-SKU-XXXXXX",
52
- # "title": "New Sku",
53
- # "slug": "new-sku",
54
- # "product_id": 1
55
- # }
56
- # @data = @mints_user.create_sku(data)
57
- def create_sku(data)
58
- @client.raw("post", "/ecommerce/skus", nil, data_transform(data))
59
- end
60
-
61
- # === Update sku.
62
- # Update a sku info.
63
- #
64
- # ==== Parameters
65
- # id:: (Integer) -- Sku id.
66
- # data:: (Hash) -- Data to be submitted.
67
- #
68
- # ==== Example
69
- # data = {
70
- # "sku": "NEW-SKU-XXXXXY"
71
- # }
72
- # @data = @mints_user.update_sku(531, data)
73
- def update_sku(id, data)
74
- @client.raw("put", "/ecommerce/skus/#{id}", nil, data_transform(data))
75
- end
76
-
77
- # === Delete sku.
78
- # Delete a sku.
79
- #
80
- # ==== Parameters
81
- # id:: (Integer) -- Sku id.
82
- #
83
- # ==== Example
84
- # @data = @mints_user.delete_sku(531)
85
- def delete_sku(id)
86
- @client.raw("delete", "/ecommerce/skus/#{id}")
87
- end
88
- end
79
+ # === Delete sku.
80
+ # Delete a sku.
81
+ #
82
+ # ==== Parameters
83
+ # id:: (Integer) -- Sku id.
84
+ #
85
+ # ==== Example
86
+ # @data = @mints_user.delete_sku(531)
87
+ def delete_sku(id)
88
+ @client.raw('delete', "/ecommerce/skus/#{id}")
89
+ end
90
+ end
@@ -1,82 +1,84 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Taxes
2
- ##
3
- # == Taxes
4
- #
4
+ ##
5
+ # == Taxes
6
+ #
7
+
8
+ # === Get taxes.
9
+ # Get a collection of taxes.
10
+ #
11
+ # ==== Parameters
12
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
13
+ #
14
+ # ==== First Example
15
+ # @data = @mints_user.get_taxes
16
+ #
17
+ # ==== Second Example
18
+ # options = { fields: 'title' }
19
+ # @data = @mints_user.get_taxes(options)
20
+ def get_taxes(options = nil)
21
+ @client.raw('get', '/ecommerce/taxes', options)
22
+ end
23
+
24
+ # === Get tax.
25
+ # Get a tax info.
26
+ #
27
+ # ==== Parameters
28
+ # id:: (Integer) -- Tax 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_tax(1)
33
+ #
34
+ # ==== Second Example
35
+ # options = { fields: 'title' }
36
+ # @data = @mints_user.get_tax(1, options)
37
+ def get_tax(id, options = nil)
38
+ @client.raw('get', "/ecommerce/taxes/#{id}", options)
39
+ end
40
+
41
+ # === Create tax.
42
+ # Create a tax with data.
43
+ #
44
+ # ==== Parameters
45
+ # data:: (Hash) -- Data to be submitted.
46
+ #
47
+ # ==== Example
48
+ # data = {
49
+ # title: 'New Tax',
50
+ # tax_percentage: 100
51
+ # }
52
+ # @data = @mints_user.create_tax(data)
53
+ def create_tax(data)
54
+ @client.raw('post', '/ecommerce/taxes', nil, data_transform(data))
55
+ end
5
56
 
6
- # === Get taxes.
7
- # Get a collection of taxes.
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_taxes
14
- #
15
- # ==== Second Example
16
- # options = { "fields": "title" }
17
- # @data = @mints_user.get_taxes(options)
18
- def get_taxes(options = nil)
19
- @client.raw("get", "/ecommerce/taxes", options)
20
- end
57
+ # === Update tax.
58
+ # Update a tax info.
59
+ #
60
+ # ==== Parameters
61
+ # id:: (Integer) -- Tax id.
62
+ # data:: (Hash) -- Data to be submitted.
63
+ #
64
+ # ==== Example
65
+ # data = {
66
+ # tax_percentage: 10
67
+ # }
68
+ # @data = @mints_user.update_tax(11, data)
69
+ def update_tax(id, data)
70
+ @client.raw('put', "/ecommerce/taxes/#{id}", nil, data_transform(data))
71
+ end
21
72
 
22
- # === Get tax.
23
- # Get a tax info.
24
- #
25
- # ==== Parameters
26
- # id:: (Integer) -- Tax id.
27
- # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
28
- #
29
- # ==== First Example
30
- # @data = @mints_user.get_tax(1)
31
- #
32
- # ==== Second Example
33
- # options = { "fields": "title" }
34
- # @data = @mints_user.get_tax(1, options)
35
- def get_tax(id, options = nil)
36
- @client.raw("get", "/ecommerce/taxes/#{id}", options)
37
- end
38
-
39
- # === Create tax.
40
- # Create a tax with data.
41
- #
42
- # ==== Parameters
43
- # data:: (Hash) -- Data to be submitted.
44
- #
45
- # ==== Example
46
- # data = {
47
- # "title": "New Tax",
48
- # "tax_percentage": 100
49
- # }
50
- # @data = @mints_user.create_tax(data)
51
- def create_tax(data)
52
- @client.raw("post", "/ecommerce/taxes", nil, data_transform(data))
53
- end
54
-
55
- # === Update tax.
56
- # Update a tax info.
57
- #
58
- # ==== Parameters
59
- # id:: (Integer) -- Tax id.
60
- # data:: (Hash) -- Data to be submitted.
61
- #
62
- # ==== Example
63
- # data = {
64
- # "tax_percentage": 10
65
- # }
66
- # @data = @mints_user.update_tax(11, data)
67
- def update_tax(id, data)
68
- @client.raw("put", "/ecommerce/taxes/#{id}", nil, data_transform(data))
69
- end
70
-
71
- # === Delete tax.
72
- # Delete a tax.
73
- #
74
- # ==== Parameters
75
- # id:: (Integer) -- Tax id.
76
- #
77
- # ==== Example
78
- # @data = @mints_user.delete_tax(11)
79
- def delete_tax(id)
80
- @client.raw("delete", "/ecommerce/taxes/#{id}")
81
- end
82
- end
73
+ # === Delete tax.
74
+ # Delete a tax.
75
+ #
76
+ # ==== Parameters
77
+ # id:: (Integer) -- Tax id.
78
+ #
79
+ # ==== Example
80
+ # @data = @mints_user.delete_tax(11)
81
+ def delete_tax(id)
82
+ @client.raw('delete', "/ecommerce/taxes/#{id}")
83
+ end
84
+ end