mints 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/client.rb +38 -32
  3. data/lib/contact.rb +65 -60
  4. data/lib/mints/controllers/base_api_controller.rb +4 -4
  5. data/lib/mints/controllers/base_controller.rb +12 -3
  6. data/lib/mints_helper.rb +47 -0
  7. data/lib/pub.rb +75 -87
  8. data/lib/user/config/api_keys.rb +65 -0
  9. data/lib/user/config/appointments.rb +221 -0
  10. data/lib/user/config/attribute_groups.rb +77 -0
  11. data/lib/user/config/attributes.rb +86 -0
  12. data/lib/user/config/calendars.rb +89 -0
  13. data/lib/user/config/config.rb +65 -0
  14. data/lib/user/config/importers.rb +184 -0
  15. data/lib/user/config/public_folders.rb +108 -0
  16. data/lib/user/config/relationships.rb +138 -0
  17. data/lib/user/config/roles.rb +84 -0
  18. data/lib/user/config/seeds.rb +14 -0
  19. data/lib/user/config/system_settings.rb +53 -0
  20. data/lib/user/config/tags.rb +63 -0
  21. data/lib/user/config/taxonomies.rb +124 -0
  22. data/lib/user/config/teams.rb +70 -0
  23. data/lib/user/config/users.rb +76 -0
  24. data/lib/user/contacts/contacts.rb +21 -0
  25. data/lib/user/content/assets.rb +98 -0
  26. data/lib/user/content/content.rb +235 -0
  27. data/lib/user/content/content_instances.rb +147 -0
  28. data/lib/user/content/content_templates.rb +111 -0
  29. data/lib/user/content/conversations.rb +174 -0
  30. data/lib/user/content/dam.rb +88 -0
  31. data/lib/user/content/forms.rb +168 -0
  32. data/lib/user/content/message_templates.rb +162 -0
  33. data/lib/user/content/messages.rb +90 -0
  34. data/lib/user/content/pages.rb +81 -0
  35. data/lib/user/content/stories.rb +164 -0
  36. data/lib/user/content/story_templates.rb +95 -0
  37. data/lib/user/crm/companies.rb +111 -0
  38. data/lib/user/crm/contacts.rb +312 -0
  39. data/lib/user/crm/crm.rb +21 -0
  40. data/lib/user/crm/deals.rb +111 -0
  41. data/lib/user/crm/favorites.rb +17 -0
  42. data/lib/user/crm/segments.rb +132 -0
  43. data/lib/user/crm/users.rb +22 -0
  44. data/lib/user/crm/workflow_step_objects.rb +89 -0
  45. data/lib/user/crm/workflow_steps.rb +49 -0
  46. data/lib/user/crm/workflows.rb +70 -0
  47. data/lib/user/ecommerce/ecommerce.rb +29 -0
  48. data/lib/user/ecommerce/item_prices.rb +86 -0
  49. data/lib/user/ecommerce/locations.rb +166 -0
  50. data/lib/user/ecommerce/order_items_groups.rb +109 -0
  51. data/lib/user/ecommerce/order_statuses.rb +26 -0
  52. data/lib/user/ecommerce/orders.rb +258 -0
  53. data/lib/user/ecommerce/price_lists.rb +73 -0
  54. data/lib/user/ecommerce/product_templates.rb +104 -0
  55. data/lib/user/ecommerce/product_variations.rb +129 -0
  56. data/lib/user/ecommerce/products.rb +169 -0
  57. data/lib/user/ecommerce/skus.rb +88 -0
  58. data/lib/user/ecommerce/taxes.rb +82 -0
  59. data/lib/user/ecommerce/variant_options.rb +69 -0
  60. data/lib/user/ecommerce/variant_values.rb +72 -0
  61. data/lib/user/helpers/helpers.rb +113 -0
  62. data/lib/user/helpers/object_activities.rb +83 -0
  63. data/lib/user/helpers/object_folders.rb +82 -0
  64. data/lib/user/helpers/user_folders.rb +83 -0
  65. data/lib/user/marketing/marketing.rb +120 -0
  66. data/lib/user/profile/profile.rb +111 -0
  67. data/lib/user.rb +22 -922
  68. metadata +61 -1
@@ -0,0 +1,49 @@
1
+ module WorkFlowSteps
2
+ ##
3
+ # == Workflow Steps
4
+ #
5
+
6
+ # === Create workflow step.
7
+ # Create a workflow step with data.
8
+ #
9
+ # ==== Parameters
10
+ # data:: (Hash) -- Data to be submited.
11
+ #
12
+ # ==== Example
13
+ # data = {
14
+ # "stepTitle": "Step Title",
15
+ # "workflowId": 1
16
+ # }
17
+ # @data = @mints_user.create_workflow_step(data.to_json)
18
+ def create_workflow_step(data)
19
+ return @client.raw("post", "/crm/steps", nil, data)
20
+ end
21
+
22
+ # === Update workflow step.
23
+ # Update a workflow step info.
24
+ #
25
+ # ==== Parameters
26
+ # id:: (Integer) -- Workflow step id.
27
+ # data:: (Hash) -- Data to be submited.
28
+ #
29
+ # ==== Example
30
+ # data = {
31
+ # "stepTitle": "Step Title Modified"
32
+ # }
33
+ # @data = @mints_user.update_workflow_step(23, data)
34
+ def update_workflow_step(id, data)
35
+ return @client.raw("put", "/crm/steps/#{id}", nil, data)
36
+ end
37
+
38
+ # === Delete workflow step.
39
+ # Delete a workflow step.
40
+ #
41
+ # ==== Parameters
42
+ # id:: (Integer) -- Workflow step id.
43
+ #
44
+ # ==== Example
45
+ # @data = @mints_user.delete_workflow_step(51)
46
+ def delete_workflow_step(id)
47
+ return @client.raw("delete", "/crm/steps/#{id}")
48
+ end
49
+ end
@@ -0,0 +1,70 @@
1
+ module Workflows
2
+ ##
3
+ # == Workflows
4
+ #
5
+
6
+ # === Get workflows.
7
+ # Get a collection of workflows.
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_workflows
14
+ #
15
+ # ==== Second Example
16
+ # options = { "sort": "title", "fields": "title" }
17
+ # @data = @mints_user.get_workflows(options)
18
+ def get_workflows(options = nil)
19
+ return @client.raw("get", "/crm/workflows", options)
20
+ end
21
+
22
+ # === Get workflow.
23
+ # Get a workflow.
24
+ #
25
+ # ==== Parameters
26
+ # id:: (Integer) -- Workflow 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_workflow(1)
31
+ #
32
+ # ==== Second Example
33
+ # options = { "fields": "id, title" }
34
+ # @data = @mints_user.get_workflow(1, options)
35
+ def get_workflow(id, options = nil)
36
+ return @client.raw("get", "/crm/workflows/#{id}", options)
37
+ end
38
+
39
+ # === Create workflow.
40
+ # Create a workflow with data.
41
+ #
42
+ # ==== Parameters
43
+ # data:: (Hash) -- Data to be submited.
44
+ #
45
+ # ==== Example
46
+ # data = {
47
+ # "title": "New Workflow",
48
+ # "object_type": "deals"
49
+ # }
50
+ # @data = @mints_user.create_workflow(data.to_json)
51
+ def create_workflow(data)
52
+ return @client.raw("post", "/crm/workflows/", nil, data)
53
+ end
54
+
55
+ # === Update workflow.
56
+ # Update a workflow info.
57
+ #
58
+ # ==== Parameters
59
+ # id:: (Integer) -- Workflow id.
60
+ # data:: (Hash) -- Data to be submited.
61
+ #
62
+ # ==== Example
63
+ # data = {
64
+ # "title": "New Workflow Modified"
65
+ # }
66
+ # @data = @mints_user.update_workflow(7, data)
67
+ def update_workflow(id, data)
68
+ return @client.raw("put", "/crm/workflows/#{id}", nil, correct_json(data))
69
+ end
70
+ end
@@ -0,0 +1,29 @@
1
+ require_relative './item_prices.rb'
2
+ require_relative './locations.rb'
3
+ require_relative './order_items_groups.rb'
4
+ require_relative './order_statuses.rb'
5
+ require_relative './orders.rb'
6
+ require_relative './price_lists.rb'
7
+ require_relative './product_templates.rb'
8
+ require_relative './product_variations.rb'
9
+ require_relative './products.rb'
10
+ require_relative './skus.rb'
11
+ require_relative './taxes.rb'
12
+ require_relative './variant_options.rb'
13
+ require_relative './variant_values.rb'
14
+
15
+ module Ecommerce
16
+ include ItemPrices
17
+ include Locations
18
+ include OrderItemsGroups
19
+ include OrderStatuses
20
+ include Orders
21
+ include PriceList
22
+ include ProductTemplates
23
+ include ProductVariations
24
+ include Products
25
+ include Skus
26
+ include Taxes
27
+ include VariantOptions
28
+ include VariantValues
29
+ end
@@ -0,0 +1,86 @@
1
+ module ItemPrices
2
+ ##
3
+ # == Item Prices
4
+ #
5
+
6
+ # === Get item prices.
7
+ # Get a collection of item prices.
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_item_prices
14
+ #
15
+ # ==== Second Example
16
+ # options = { "fields": "price_cents" }
17
+ # @data = @mints_user.get_item_prices(options)
18
+ def get_item_prices(options = nil)
19
+ return @client.raw("get", "/ecommerce/item-prices", options)
20
+ end
21
+
22
+ # === Get item price.
23
+ # Get a item price info.
24
+ #
25
+ # ==== Parameters
26
+ # id:: (Integer) -- Item price 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_item_price(1)
31
+ #
32
+ # ==== Second Example
33
+ # options = { "fields": "price_cents" }
34
+ # @data = @mints_user.get_item_price(1, options)
35
+ def get_item_price(id, options = nil)
36
+ return @client.raw("get", "/ecommerce/item-prices/#{id}", options)
37
+ end
38
+
39
+ # === Create item price.
40
+ # Create a item price with data.
41
+ #
42
+ # ==== Parameters
43
+ # data:: (Hash) -- Data to be submited.
44
+ #
45
+ # ==== Example
46
+ # data = {
47
+ # "price_list": [
48
+ # { "id": 1 },
49
+ # { "id": 2 }
50
+ # ],
51
+ # "price_list_id": 1,
52
+ # "title": "New Item Price"
53
+ # }
54
+ # @data = @mints_user.create_item_price(data)
55
+ def create_item_price(data) #FIXME: Api send sku_id as null and DB doesnt allow that.
56
+ return @client.raw("post", "/ecommerce/item-prices", nil, data_transform(data))
57
+ end
58
+
59
+ # === Update item price.
60
+ # Update a item price info.
61
+ #
62
+ # ==== Parameters
63
+ # id:: (Integer) -- Order item price id.
64
+ # data:: (Hash) -- Data to be submited.
65
+ #
66
+ # ==== Example
67
+ # data = {
68
+ # "price": 12345
69
+ # }
70
+ # @data = @mints_user.update_item_price(1, data)
71
+ def update_item_price(id, data)
72
+ return @client.raw("put", "/ecommerce/item-prices/#{id}", nil, data_transform(data))
73
+ end
74
+
75
+ # === Delete item price.
76
+ # Delete a item price.
77
+ #
78
+ # ==== Parameters
79
+ # id:: (Integer) -- Item price id.
80
+ #
81
+ # ==== Example
82
+ # @data = @mints_user.delete_item_price(803)
83
+ def delete_item_price(id)
84
+ return @client.raw("delete", "/ecommerce/item-prices/#{id}")
85
+ end
86
+ end
@@ -0,0 +1,166 @@
1
+ module Locations
2
+ ##
3
+ # == Locations
4
+ #
5
+
6
+ # === Get locations.
7
+ # Get a collection of locations.
8
+ #
9
+ # ==== Parameters
10
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
11
+ #
12
+ # ==== First Example
13
+ # @data = @mints_user.get_locations
14
+ #
15
+ # ==== Second Example
16
+ # @data = @mints_user.get_locations(false)
17
+ def get_locations(use_post = true)
18
+ return get_query_results("/ecommerce/locations", nil, use_post)
19
+ end
20
+
21
+ # === Get location.
22
+ # Get a location info.
23
+ #
24
+ # ==== Parameters
25
+ # id:: (Integer) -- Location id.
26
+ #
27
+ # ==== Example
28
+ # @data = @mints_user.get_location(2)
29
+ def get_location(id)
30
+ return @client.raw("get", "/ecommerce/locations/#{id}")
31
+ end
32
+
33
+ # === Create location.
34
+ # Create a location with data.
35
+ #
36
+ # ==== Parameters
37
+ # data:: (Hash) -- Data to be submited.
38
+ #
39
+ # ==== Example
40
+ # data = {
41
+ # "title": "New Location",
42
+ # "location_template_id": 1
43
+ # }
44
+ # @data = @mints_user.create_location(data)
45
+ def create_location(data)
46
+ return @client.raw("post", "/ecommerce/locations", nil, data_transform(data))
47
+ end
48
+
49
+ # === Update location.
50
+ # Update a location info.
51
+ #
52
+ # ==== Parameters
53
+ # id:: (Integer) -- Location id.
54
+ # data:: (Hash) -- Data to be submited.
55
+ #
56
+ # ==== Example
57
+ # data = {
58
+ # "title": "New Location Modified"
59
+ # }
60
+ # @data = @mints_user.update_location(5, data.to_json)
61
+ def update_location(id, data)
62
+ return @client.raw("put", "/ecommerce/locations/#{id}", nil, data)
63
+ end
64
+
65
+ # === Delete location.
66
+ # Delete a location.
67
+ #
68
+ # ==== Parameters
69
+ # id:: (Integer) -- Location id.
70
+ #
71
+ # ==== Example
72
+ # @data = @mints_user.delete_location(5)
73
+ def delete_location(id)
74
+ return @client.raw("delete", "/ecommerce/locations/#{id}")
75
+ end
76
+
77
+ ##
78
+ # == Locations Templates
79
+ #
80
+
81
+ # === Get location template support data.
82
+ # Get support data used in a location template.
83
+ #
84
+ # ==== Parameters
85
+ # id:: (Integer) -- Location template id.
86
+ #
87
+ # ==== Example
88
+ # @data = @mints_user.get_location_template_support_data(1)
89
+ def get_location_template_support_data(id)
90
+ return @client.raw("get", "/ecommerce/location-templates/#{id}/support-data")
91
+ end
92
+
93
+ # === Get location templates support data.
94
+ # Get support data used in location templates.
95
+ #
96
+ # ==== Example
97
+ # @data = @mints_user.get_location_templates_support_data
98
+ def get_location_templates_support_data
99
+ return @client.raw("get", "/ecommerce/location-templates/support-data")
100
+ end
101
+
102
+ # === Get location templates.
103
+ # Get a collection of location templates.
104
+ #
105
+ # ==== Parameters
106
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
107
+ #
108
+ # ==== First Example
109
+ # @data = @mints_user.get_location_templates
110
+ #
111
+ # ==== Second Example
112
+ # options = { "fields": "title" }
113
+ # @data = @mints_user.get_location_templates(options)
114
+ def get_location_templates(options = nil)
115
+ return @client.raw("get", "/ecommerce/location-templates", options)
116
+ end
117
+
118
+ # === Get location template.
119
+ # Get a location template info.
120
+ #
121
+ # ==== Parameters
122
+ # id:: (Integer) -- Location template id.
123
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
124
+ #
125
+ # ==== First Example
126
+ # @data = @mints_user.get_location_template(1)
127
+ #
128
+ # ==== Second Example
129
+ # options = { "fields": "title" }
130
+ # @data = @mints_user.get_location_template(1, options)
131
+ def get_location_template(id, options = nil)
132
+ return @client.raw("get", "/ecommerce/location-templates/#{id}", options)
133
+ end
134
+
135
+ # === Create location template.
136
+ # Create a location template with data.
137
+ #
138
+ # ==== Parameters
139
+ # data:: (Hash) -- Data to be submited.
140
+ #
141
+ # ==== Example
142
+ # data = {
143
+ # "title": "New Location Template",
144
+ # "slug": "new-location-template"
145
+ # }
146
+ # @data = @mints_user.create_location_template(data)
147
+ def create_location_template(data)
148
+ return @client.raw("post", "/ecommerce/location-templates", nil, data_transform(data))
149
+ end
150
+
151
+ # === Update location template.
152
+ # Update a location template info.
153
+ #
154
+ # ==== Parameters
155
+ # id:: (Integer) -- Location template id.
156
+ # data:: (Hash) -- Data to be submited.
157
+ #
158
+ # ==== Example
159
+ # data = {
160
+ # "title": "New Location Template Modified"
161
+ # }
162
+ # @data = @mints_user.update_location_template(3, data)
163
+ def update_location_template(id, data)
164
+ return @client.raw("put", "/ecommerce/location-templates/#{id}", nil, data_transform(data))
165
+ end
166
+ end
@@ -0,0 +1,109 @@
1
+ module OrderItemsGroups
2
+ ##
3
+ # == Order Items Groups
4
+ #
5
+
6
+ # === Get pending order template from order item group.
7
+ # Get a pending order template from an order item group.
8
+ #
9
+ # ==== Parameters
10
+ # parentOrderId:: (Integer) -- Order items group id.
11
+ # orderTemplateId:: (Integer) -- Order template id.
12
+ #
13
+ # ==== Example
14
+ # @data = @mints_user.get_pending_order_template_from_order_item_group(1, 1)
15
+ def get_pending_order_template_from_order_item_group(parentOrderId, orderTemplateId)
16
+ return @client.raw("get", "/ecommerce/order-items-groups/#{parentOrderId}/pending-items/order-template/#{orderTemplateId}")
17
+ end
18
+
19
+ # === Get order item group support data by order id.
20
+ # Get support data of an order item group by an order id.
21
+ #
22
+ # ==== Parameters
23
+ # orderId:: (Integer) -- Order id.
24
+ #
25
+ # ==== Example
26
+ # @data = @mints_user.get_order_item_group_support_data_by_order_id(1)
27
+ def get_order_item_group_support_data_by_order_id(orderId) #FIXME: Return in OrderItemsGroupController.getTemplateSupportDataByOrderId method doesnt create data variable.
28
+ return @client.raw("get", "/ecommerce/order-items-groups/support-data/#{orderId}")
29
+ end
30
+
31
+ # === Get order item groups.
32
+ # Get a collection of order item groups.
33
+ #
34
+ # ==== Parameters
35
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
36
+ #
37
+ # ==== First Example
38
+ # @data = @mints_user.get_order_item_groups
39
+ #
40
+ # ==== Second Example
41
+ # options = { "fields": "name" }
42
+ # @data = @mints_user.get_order_item_groups(options)
43
+ def get_order_item_groups(options = nil)
44
+ return @client.raw("get", "/ecommerce/order-items-groups", options)
45
+ end
46
+
47
+ # === Get order item group.
48
+ # Get a order item group info.
49
+ #
50
+ # ==== Parameters
51
+ # id:: (Integer) -- Order item group id.
52
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
53
+ #
54
+ # ==== First Example
55
+ # @data = @mints_user.get_order_item_group(1)
56
+ #
57
+ # ==== Second Example
58
+ # options = { "fields": "name" }
59
+ # @data = @mints_user.get_order_item_group(1, options)
60
+ def get_order_item_group(id, options = nil)
61
+ return @client.raw("get", "/ecommerce/order-items-groups/#{id}", options)
62
+ end
63
+
64
+ # === Create order item group.
65
+ # Create a order item group with data.
66
+ #
67
+ # ==== Parameters
68
+ # data:: (Hash) -- Data to be submited.
69
+ #
70
+ # ==== Example
71
+ # data = {
72
+ # "name": "New Order Item Group",
73
+ # "order_id": 1,
74
+ # "quantity": 1,
75
+ # "sale_price": 200
76
+ # }
77
+ # @data = @mints_user.create_order_item_group(data)
78
+ def create_order_item_group(data)
79
+ return @client.raw("post", "/ecommerce/order-items-groups", nil, data_transform(data))
80
+ end
81
+
82
+ # === Update order item group.
83
+ # Update a order item group info.
84
+ #
85
+ # ==== Parameters
86
+ # id:: (Integer) -- Order item group id.
87
+ # data:: (Hash) -- Data to be submited.
88
+ #
89
+ # ==== Example
90
+ # data = {
91
+ # "name": "New Order Item Group Modified"
92
+ # }
93
+ # @data = @mints_user.update_order_item_group(147, data)
94
+ def update_order_item_group(id, data)
95
+ return @client.raw("put", "/ecommerce/order-items-groups/#{id}", nil, data_transform(data))
96
+ end
97
+
98
+ # === Delete order item group.
99
+ # Delete a order item group.
100
+ #
101
+ # ==== Parameters
102
+ # id:: (Integer) -- Order item group id.
103
+ #
104
+ # ==== Example
105
+ # @data = @mints_user.delete_order_item_group(147)
106
+ def delete_order_item_group(id)
107
+ return @client.raw("delete", "/ecommerce/order-items-groups/#{id}")
108
+ end
109
+ end
@@ -0,0 +1,26 @@
1
+ module OrderStatuses
2
+ ##
3
+ # == Order Statuses
4
+ #
5
+
6
+ # === Get order statuses.
7
+ # Get order statuses.
8
+ #
9
+ # ==== First Example
10
+ # @data = @mints_user.get_order_statuses
11
+ def get_order_statuses
12
+ return @client.raw("get", "/ecommerce/order-statuses")
13
+ end
14
+
15
+ # === Get order status.
16
+ # Get status of an order.
17
+ #
18
+ # ==== Parameters
19
+ # id:: (Integer) -- Order id.
20
+ #
21
+ # ==== First Example
22
+ # @data = @mints_user.get_order_status(1)
23
+ def get_order_status(id)
24
+ return @client.raw("get", "/ecommerce/order-statuses/#{id}")
25
+ end
26
+ end