mints 0.0.16 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
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,162 @@
1
+ module MessageTemplates
2
+ ##
3
+ # == Message Template
4
+ #
5
+
6
+ # === Get variables of content page from message template.
7
+ # Get variables used in a specified content page located in message templates.
8
+ #
9
+ # ==== Parameters
10
+ # id:: (Integer) -- Content page id.
11
+ #
12
+ # ==== Example
13
+ # @data = @mints_user.get_variables_of_content_page_from_message_templates(2)
14
+ def get_variables_of_content_page_from_message_templates(id)
15
+ return @client.raw("get", "/content/message-templates/content-pages/#{id}/variables")
16
+ end
17
+
18
+ # === Get recipient variables.
19
+ # Get recipient variables in message templates.
20
+ #
21
+ # ==== Example
22
+ # @data = @mints_user.get_recipient_variables
23
+ def get_recipient_variables
24
+ return @client.raw("get", "/content/message-templates/recipient-variables")
25
+ end
26
+
27
+ # === Get driver templates.
28
+ # Get driver templates in message templates.
29
+ #
30
+ # ==== Example
31
+ # @data = @mints_user.get_driver_templates
32
+ def get_driver_templates
33
+ return @client.raw("get", "/content/email-templates/driver/templates")
34
+ end
35
+
36
+ # === Preview message template.
37
+ # Preview an message template based in data.
38
+ #
39
+ # ==== Parameters
40
+ # data:: (Hash) -- Data to be submited.
41
+ #
42
+ # ==== Example
43
+ # variables = {
44
+ # "variable_1": 1,
45
+ # "variable_2": "City"
46
+ # }
47
+ # data = {
48
+ # "body": "Message Template {{ variable_2 }}",
49
+ # "variables": variables.to_json
50
+ # }
51
+ # @data = @mints_user.preview_message_template(data)
52
+ def preview_message_template(data)
53
+ return @client.raw("post", "/content/message-templates/preview", nil, data_transform(data))
54
+ end
55
+
56
+ # === Send Message Template.
57
+ # Send an message template to different contacts.
58
+ #
59
+ # ==== Parameters
60
+ # data:: (Hash) -- Data to be submited.
61
+ #
62
+ # ==== Example
63
+ # data = {
64
+ # "contacts": [
65
+ # { "id": 10 }
66
+ # ],
67
+ # "emailTemplateId": 1,
68
+ # "resend": false
69
+ # }
70
+ # @data = @mints_user.send_message_template(data)
71
+ def send_message_template(data)
72
+ return @client.raw("post", "/content/message-templates/send", nil, data_transform(data))
73
+ end
74
+
75
+ # === Duplicate Message Template.
76
+ # Duplicate an message template.
77
+ #
78
+ # ==== Parameters
79
+ # id:: (Integer) -- Message template id.
80
+ # data:: (Hash) -- Data to be submited.
81
+ #
82
+ def duplicate_message_template(id, data) #FIXME: Error in duplicating
83
+ return @client.raw("post", "/content/message-templates/#{id}/duplicate", nil, data_transform(data))
84
+ end
85
+
86
+ # === Get message templates.
87
+ # Get a collection of message templates.
88
+ #
89
+ # ==== Parameters
90
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
91
+ #
92
+ # ==== First Example
93
+ # @data = @mints_user.get_message_templates
94
+ #
95
+ # ==== Second Example
96
+ # options = { "fields": "id" }
97
+ # @data = @mints_user.get_message_templates(options)
98
+ def get_message_templates(options = nil)
99
+ return @client.raw("get", "/content/message-templates", options)
100
+ end
101
+
102
+ # === Get message template.
103
+ # Get an message template info.
104
+ #
105
+ # ==== Parameters
106
+ # id:: (Integer) -- Message template id.
107
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
108
+ #
109
+ # ==== First Example
110
+ # @data = @mints_user.get_message_template(1)
111
+ #
112
+ # ==== Second Example
113
+ # options = { "fields": "id" }
114
+ # @data = @mints_user.get_message_template(1, options)
115
+ def get_message_template(id, options = nil)
116
+ return @client.raw("get", "/content/message-templates/#{id}", options)
117
+ end
118
+
119
+ # === Create message template.
120
+ # Create an message template with data.
121
+ #
122
+ # ==== Parameters
123
+ # data:: (Hash) -- Data to be submited.
124
+ #
125
+ # ==== Example
126
+ # data = {
127
+ # "title": "New Message Template",
128
+ # "slug": "new-message-template"
129
+ # }
130
+ # @data = @mints_user.create_message_template(data)
131
+ def create_message_template(data)
132
+ return @client.raw("post", "/content/message-templates", nil, data_transform(data))
133
+ end
134
+
135
+ # === Update message template.
136
+ # Update an message template info.
137
+ #
138
+ # ==== Parameters
139
+ # id:: (Integer) -- Message template id.
140
+ # data:: (Hash) -- Data to be submited.
141
+ #
142
+ # ==== Example
143
+ # data = {
144
+ # "title": "New Message Template Modified"
145
+ # }
146
+ # @data = @mints_user.update_message_template(5, data)
147
+ def update_message_template(id, data)
148
+ return @client.raw("put", "/content/message-templates/#{id}", nil, data_transform(data))
149
+ end
150
+
151
+ # === Delete message template.
152
+ # Delete an message template.
153
+ #
154
+ # ==== Parameters
155
+ # id:: (Integer) -- Message template id.
156
+ #
157
+ # ==== Example
158
+ # @data = @mints_user.delete_message_template(2)
159
+ def delete_message_template(id)
160
+ return @client.raw("delete", "/content/message-templates/#{id}")
161
+ end
162
+ end
@@ -0,0 +1,90 @@
1
+ module Messages
2
+ ##
3
+ # == Messages
4
+ #
5
+
6
+ ###
7
+ # === Get messages.
8
+ # Get a collection of messages.
9
+ #
10
+ # ==== Parameters
11
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
12
+ #
13
+ # ==== First Example
14
+ # @data = @mints_user.get_messages
15
+ #
16
+ # ==== Second Example
17
+ # options = { "fields": "value" }
18
+ # @data = @mints_user.get_messages(options)
19
+ def get_messages(options = nil)
20
+ return @client.raw("get", "/content/messages", options)
21
+ end
22
+
23
+ # === Get message.
24
+ # Get a message info.
25
+ #
26
+ # ==== Parameters
27
+ # id:: (Integer) -- Message id.
28
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
29
+ #
30
+ # ==== First Example
31
+ # @data = @mints_user.get_message(1)
32
+ #
33
+ # ==== Second Example
34
+ # options = { "fields": "value" }
35
+ # @data = @mints_user.get_message(1, options)
36
+ def get_message(id, options = nil)
37
+ return @client.raw("get", "/content/messages/#{id}", options)
38
+ end
39
+
40
+ # === Create message.
41
+ # Create a message with data.
42
+ #
43
+ # ==== Parameters
44
+ # data:: (Hash) -- Data to be submited.
45
+ #
46
+ # ==== Example
47
+ # data = {
48
+ # "type": "text",
49
+ # "conversation_id": 1,
50
+ # "sender_type": "User",
51
+ # "sender_id": 1,
52
+ # "value": {
53
+ # "text": "Hello"
54
+ # }
55
+ # }
56
+ # @data = @mints_user.create_message(data)
57
+ def create_message(data)
58
+ return @client.raw("post", "/content/messages", nil, data_transform(data))
59
+ end
60
+
61
+ # === Update message.
62
+ # Update a message info.
63
+ #
64
+ # ==== Parameters
65
+ # id:: (Integer) -- Message id.
66
+ # data:: (Hash) -- Data to be submited.
67
+ #
68
+ # ==== Example
69
+ # data = {
70
+ # "value": {
71
+ # "text": "Hello World!"
72
+ # }
73
+ # }
74
+ # @data = @mints_user.update_message(102, data)
75
+ def update_message(id, data)
76
+ return @client.raw("put", "/content/messages/#{id}", nil, data_transform(data))
77
+ end
78
+
79
+ # === Delete message.
80
+ # Delete a message.
81
+ #
82
+ # ==== Parameters
83
+ # id:: (Integer) -- Message id.
84
+ #
85
+ # ==== Example
86
+ # @data = @mints_user.delete_message(101)
87
+ def delete_message(id)
88
+ return @client.raw("delete", "/content/messages/#{id}")
89
+ end
90
+ end
@@ -0,0 +1,81 @@
1
+ module Pages
2
+ ##
3
+ # == Content Pages
4
+ #
5
+
6
+ ###
7
+ # === Get page groups.
8
+ # Get content page groups.
9
+ #
10
+ # ==== Example
11
+ # @data = @mints_user.get_page_groups
12
+ def get_page_groups
13
+ return @client.raw("get", "/content/pages/groups")
14
+ end
15
+
16
+ # === Get pages.
17
+ # Get a collection of content pages.
18
+ #
19
+ # ==== Example
20
+ # @data = @mints_user.get_pages
21
+ def get_pages
22
+ return @client.raw("get", "/content/pages")
23
+ end
24
+
25
+ # === Get page.
26
+ # Get a content page.
27
+ #
28
+ # ==== Parameters
29
+ # id:: (Integer) -- Page id.
30
+ #
31
+ # ==== Example
32
+ # @data = @mints_user.get_page(1)
33
+ def get_page(id)
34
+ return @client.raw("get", "/content/pages/#{id}")
35
+ end
36
+
37
+ # === Create page.
38
+ # Create a content page with data.
39
+ #
40
+ # ==== Parameters
41
+ # data:: (Hash) -- Data to be submited.
42
+ #
43
+ # ==== Example
44
+ # data = {
45
+ # "title": "New Page",
46
+ # "slug": "new-page-slug",
47
+ # "description": "New page description"
48
+ # }
49
+ # @data = @mints_user.create_page(data)
50
+ def create_page(data)
51
+ return @client.raw("post", "/content/pages", nil, data_transform(data))
52
+ end
53
+
54
+ # === Update page.
55
+ # Update a content page info.
56
+ #
57
+ # ==== Parameters
58
+ # id:: (Integer) -- Page id.
59
+ # data:: (Hash) -- Data to be submited.
60
+ #
61
+ # ==== Example
62
+ # data = {
63
+ # "title": "New Page Modified"
64
+ # }
65
+ # @data = @mints_user.update_page(5, data.to_json)
66
+ def update_page(id, data)
67
+ return @client.raw("put", "/content/pages/#{id}", nil, data)
68
+ end
69
+
70
+ # === Delete page.
71
+ # Delete a content page.
72
+ #
73
+ # ==== Parameters
74
+ # id:: (Integer) -- Page id.
75
+ #
76
+ # ==== Example
77
+ # @mints_user.@mints_user.delete_page(3)
78
+ def delete_page(id)
79
+ return @client.raw("delete", "/content/pages/#{id}")
80
+ end
81
+ end
@@ -0,0 +1,164 @@
1
+ module Stories
2
+ ##
3
+ # == Story
4
+ #
5
+
6
+ # === Publish story.
7
+ # Publish a story.
8
+ #
9
+ # ==== Parameters
10
+ # id:: (Integer) -- Story id.
11
+ # data:: (Hash) -- Data to be submited.
12
+ #
13
+ # ==== Example
14
+ # data = {
15
+ # "scheduled_at": "2021-09-06T20:29:16+00:00"
16
+ # }
17
+ # @data = @mints_user.publish_story(2, data)
18
+ def publish_story(id, data)
19
+ return @client.raw("put", "/content/stories/#{id}/publish", nil, data_transform(data))
20
+ end
21
+
22
+ # === Schedule story.
23
+ # Schedule a story in a specified date.
24
+ #
25
+ # ==== Parameters
26
+ # id:: (Integer) -- Story id.
27
+ # data:: (Hash) -- Data to be submited.
28
+ #
29
+ # ==== Example
30
+ # data = {
31
+ # "scheduled_at": "2021-09-06T20:29:16+00:00"
32
+ # }
33
+ # @data = @mints_user.schedule_story(1, data)
34
+ def schedule_story(id, data)
35
+ return @client.raw("put", "/content/stories/#{id}/schedule", nil, data_transform(data))
36
+ end
37
+
38
+ # === Revert published story.
39
+ # Revert a published story.
40
+ #
41
+ # ==== Parameters
42
+ # id:: (Integer) -- Story id.
43
+ #
44
+ # ==== Example
45
+ # @data = @mints_user.revert_published_story(1)
46
+ def revert_published_story(id)
47
+ return @client.raw("get", "/content/stories/#{id}/revert-published-data")
48
+ end
49
+
50
+ # === Get stories support data.
51
+ # Get support data used in stories.
52
+ #
53
+ # ==== Example
54
+ # @data = @mints_user.get_stories_support_data
55
+ def get_stories_support_data
56
+ return @client.raw("get", "/content/stories/support-data")
57
+ end
58
+
59
+ # === Duplicate story.
60
+ # Duplicate a story.
61
+ #
62
+ # ==== Parameters
63
+ # id:: (Integer) -- Story id.
64
+ # data:: (Hash) -- Data to be submited.
65
+ #
66
+ # ==== Example
67
+ # data = {
68
+ # "options": []
69
+ # }
70
+ # @data = @mints_user.duplicate_story(1, data.to_json)
71
+ def duplicate_story(id, data)
72
+ return @client.raw("post", "/content/stories/#{id}/duplicate", nil, data)
73
+ end
74
+
75
+ # === Get stories.
76
+ # Get a collection of stories.
77
+ #
78
+ # ==== Parameters
79
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
80
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
81
+ #
82
+ # ==== First Example
83
+ # @data = @mints_user.get_stories
84
+ #
85
+ # ==== Second Example
86
+ # options = {
87
+ # "fields": "id, title"
88
+ # }
89
+ # @data = @mints_user.get_stories(options)
90
+ #
91
+ # ==== Third Example
92
+ # options = {
93
+ # "fields": "id, title"
94
+ # }
95
+ # @data = @mints_user.get_stories(options, true)
96
+ def get_stories(options = nil, use_post = true)
97
+ return get_query_results("/content/stories", options, use_post)
98
+ end
99
+
100
+ # === Get story.
101
+ # Get a story info.
102
+ #
103
+ # ==== Parameters
104
+ # id:: (Integer) -- Story id.
105
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
106
+ #
107
+ # ==== First Example
108
+ # @data = @mints_user.get_story(1)
109
+ #
110
+ # ==== Second Example
111
+ # options = {
112
+ # "fields": "id, title"
113
+ # }
114
+ # @data = @mints_user.get_story(1, options)
115
+ def get_story(id, options = nil)
116
+ return @client.raw("get", "/content/stories/#{id}", options)
117
+ end
118
+
119
+ # === Create story.
120
+ # Create a story with data.
121
+ #
122
+ # ==== Parameters
123
+ # data:: (Hash) -- Data to be submited.
124
+ #
125
+ # ==== Example
126
+ # data = {
127
+ # "title": "New Story",
128
+ # "slug": "new-story",
129
+ # "social_metadata": "social metadata"
130
+ # }
131
+ # @data = @mints_user.create_story(data)
132
+ def create_story(data)
133
+ return @client.raw("post", "/content/stories", nil, data_transform(data))
134
+ end
135
+
136
+ # === Update story.
137
+ # Update a story info.
138
+ #
139
+ # ==== Parameters
140
+ # id:: (Integer) -- Story id.
141
+ # data:: (Hash) -- Data to be submited.
142
+ #
143
+ # ==== Example
144
+ # data = {
145
+ # "title": "New Story Modified",
146
+ # "slug": "new-story"
147
+ # }
148
+ # @data = @mints_user.update_story(5, data)
149
+ def update_story(id, data)
150
+ return @client.raw("put", "/content/stories/#{id}", nil, data_transform(data))
151
+ end
152
+
153
+ # === Delete story.
154
+ # Delete a story.
155
+ #
156
+ # ==== Parameters
157
+ # id:: (Integer) -- Story id.
158
+ #
159
+ # ==== Example
160
+ # @data = @mints_user.delete_story(6)
161
+ def delete_story(id)
162
+ return @client.raw("delete", "/content/stories/#{id}")
163
+ end
164
+ end
@@ -0,0 +1,95 @@
1
+ module StoryTemplates
2
+ ##
3
+ # == Story Template
4
+ #
5
+
6
+ # === Get support data of story template.
7
+ # Get support data used in a story template.
8
+ #
9
+ # ==== Parameters
10
+ # id:: (Integer) -- Story template id.
11
+ #
12
+ # ==== Example
13
+ # @data = @mints_user.get_story_template_support_data(1)
14
+ def get_story_template_support_data(id)
15
+ return @client.raw("get", "/content/story-templates/support-data/stories/#{id}")
16
+ end
17
+
18
+ # === Get support data of story templates.
19
+ # Get support data used in story templates.
20
+ #
21
+ # ==== Example
22
+ # @data = @mints_user.get_story_templates_support_data
23
+ def get_story_templates_support_data
24
+ return @client.raw("get", "/content/story-templates/support-data")
25
+ end
26
+
27
+ # === Get story templates.
28
+ # Get a collection of story templates.
29
+ #
30
+ # ==== Parameters
31
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
32
+ #
33
+ # ==== First Example
34
+ # @data = @mints_user.get_story_templates
35
+ #
36
+ # ==== Second Example
37
+ # options = {
38
+ # "fields": "id, title"
39
+ # }
40
+ # @data = @mints_user.get_story_templates(options)
41
+ def get_story_templates(options = nil)
42
+ return @client.raw("get", "/content/story-templates", options)
43
+ end
44
+
45
+ # === Get story template.
46
+ # Get a story template info.
47
+ #
48
+ # ==== Parameters
49
+ # id:: (Integer) -- Story template id.
50
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
51
+ #
52
+ # ==== First Example
53
+ # @data = @mints_user.get_story_template(2)
54
+ #
55
+ # ==== Second Example
56
+ # options = {
57
+ # "fields": "title"
58
+ # }
59
+ # @data = @mints_user.get_story_template(1, options)
60
+ def get_story_template(id, options = nil)
61
+ return @client.raw("get", "/content/story-templates/#{id}", options)
62
+ end
63
+
64
+ # === Create story template.
65
+ # Create a story template with data.
66
+ #
67
+ # ==== Parameters
68
+ # data:: (Hash) -- Data to be submited.
69
+ #
70
+ # ==== Example
71
+ # data = {
72
+ # "title": "New Story Template",
73
+ # "slug": "new-story-template-slug"
74
+ # }
75
+ # @data = @mints_user.create_story_template(data)
76
+ def create_story_template(data)
77
+ return @client.raw("post", "/content/story-templates", nil, data_transform(data))
78
+ end
79
+
80
+ # === Update story template.
81
+ # Update a story template info.
82
+ #
83
+ # ==== Parameters
84
+ # id:: (Integer) -- Story template id.
85
+ # data:: (Hash) -- Data to be submited.
86
+ #
87
+ # ==== Example
88
+ # data = {
89
+ # "title": "New Story Template Modified"
90
+ # }
91
+ # @data = @mints_user.update_story_template(3, data)
92
+ def update_story_template(id, data)
93
+ return @client.raw("put", "/content/story-templates/#{id}", nil, data_transform(data))
94
+ end
95
+ end
@@ -0,0 +1,111 @@
1
+ module Companies
2
+ ##
3
+ # == Companies
4
+ #
5
+
6
+ ##
7
+ # === Get companies support data.
8
+ # Get support data of companies.
9
+ #
10
+ # ==== Example
11
+ # @data = @mints_user.get_companies_support_data
12
+ def get_companies_support_data
13
+ return @client.raw("get", "/crm/companies/support-data")
14
+ end
15
+
16
+ # === Get companies.
17
+ # Get a collection of companies.
18
+ #
19
+ # ==== Parameters
20
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
21
+ # use_post:: (Boolean) -- Variable to determine if the request is by 'post' or 'get' functions.
22
+ #
23
+ # ==== First Example
24
+ # @data = @mints_user.get_companies
25
+ #
26
+ # ==== Second Example
27
+ # options = { "fields": "id, title", "sort": "-id" }
28
+ # @data = @mints_user.get_companies(options)
29
+ #
30
+ # ==== Third Example
31
+ # options = { "fields": "id, title", "sort": "-id" }
32
+ # @data = @mints_user.get_companies(options, false)
33
+ def get_companies(options = nil, use_post = true)
34
+ return get_query_results("/crm/companies", options, use_post)
35
+ end
36
+
37
+ # === Get company.
38
+ # Get a company info.
39
+ #
40
+ # ==== Parameters
41
+ # id:: (Integer) -- Company id.
42
+ # options:: (Hash) -- List of Resource Collection Options shown above can be used as parameter.
43
+ #
44
+ # ==== First Example
45
+ # @data = @mints_user.get_company(21)
46
+ #
47
+ # ==== Second Example
48
+ # options = { "fields": "id, title" }
49
+ # @data = @mints_user.get_company(21, options)
50
+ def get_company(id, options = nil)
51
+ return @client.raw("get", "/crm/companies/#{id}", options)
52
+ end
53
+
54
+ # === Create company.
55
+ # Create a company with data.
56
+ #
57
+ # ==== Parameters
58
+ # data:: (Hash) -- Data to be submited.
59
+ #
60
+ # ==== Example
61
+ # data = {
62
+ # "title": "Company Title",
63
+ # "alias": "Alias",
64
+ # "website": "www.company.example.com",
65
+ # "street1": "Company St",
66
+ # "city": "Company City",
67
+ # "region": "Company Region",
68
+ # "postal_code": "12345",
69
+ # "country_id": 144,
70
+ # "tax_identifier": nil
71
+ # }
72
+ # @data = @mints_user.create_company(data)
73
+ def create_company(data)
74
+ return @client.raw("post", "/crm/companies/", nil, data_transform(data))
75
+ end
76
+
77
+ # === Update company.
78
+ # Update a company info.
79
+ #
80
+ # ==== Parameters
81
+ # id:: (Integer) -- Company id.
82
+ # data:: (Hash) -- Data to be submited.
83
+ #
84
+ # ==== Example
85
+ # data = {
86
+ # "title": "Company Title Modified"
87
+ # }
88
+ # @data = @mints_user.update_company(23, data)
89
+ def update_company(id, data)
90
+ return @client.raw("put", "/crm/companies/#{id}", nil, data_transform(data))
91
+ end
92
+
93
+ ##
94
+ # == Companies Bulk Actions
95
+ #
96
+
97
+ # === Delete Companies.
98
+ # Delete a group of companies.
99
+ #
100
+ # ==== Parameters
101
+ # data:: (Hash) -- Data to be submited.
102
+ #
103
+ # ==== Example
104
+ # data = {
105
+ # "ids": [ 21, 22 ]
106
+ # }
107
+ # @data = @mints_user.delete_companies(data)
108
+ def delete_companies(data)
109
+ return @client.raw("delete", "/crm/companies/delete", nil, data_transform(data))
110
+ end
111
+ end