basecrm 0.1.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +2 -2
  3. data/README.md +273 -17
  4. data/lib/basecrm.rb +185 -1
  5. data/lib/basecrm/configuration.rb +59 -0
  6. data/lib/basecrm/envelope.rb +7 -0
  7. data/lib/basecrm/errors.rb +65 -0
  8. data/lib/basecrm/http_client.rb +91 -0
  9. data/lib/basecrm/middlewares/oauth_bearer_token.rb +18 -0
  10. data/lib/basecrm/middlewares/raise_error.rb +31 -0
  11. data/lib/basecrm/model.rb +6 -0
  12. data/lib/basecrm/models/account.rb +31 -0
  13. data/lib/basecrm/models/address.rb +22 -0
  14. data/lib/basecrm/models/associated_contact.rb +19 -0
  15. data/lib/basecrm/models/contact.rb +88 -0
  16. data/lib/basecrm/models/deal.rb +58 -0
  17. data/lib/basecrm/models/lead.rb +79 -0
  18. data/lib/basecrm/models/loss_reason.rb +22 -0
  19. data/lib/basecrm/models/note.rb +28 -0
  20. data/lib/basecrm/models/pipeline.rb +19 -0
  21. data/lib/basecrm/models/source.rb +22 -0
  22. data/lib/basecrm/models/stage.rb +34 -0
  23. data/lib/basecrm/models/tag.rb +25 -0
  24. data/lib/basecrm/models/task.rb +46 -0
  25. data/lib/basecrm/models/user.rb +31 -0
  26. data/lib/basecrm/paginated_resource.rb +32 -0
  27. data/lib/basecrm/services/accounts_service.rb +33 -0
  28. data/lib/basecrm/services/associated_contacts_service.rb +91 -0
  29. data/lib/basecrm/services/contacts_service.rb +138 -0
  30. data/lib/basecrm/services/deals_service.rb +137 -0
  31. data/lib/basecrm/services/leads_service.rb +140 -0
  32. data/lib/basecrm/services/loss_reasons_service.rb +133 -0
  33. data/lib/basecrm/services/notes_service.rb +134 -0
  34. data/lib/basecrm/services/pipelines_service.rb +50 -0
  35. data/lib/basecrm/services/sources_service.rb +133 -0
  36. data/lib/basecrm/services/stages_service.rb +52 -0
  37. data/lib/basecrm/services/tags_service.rb +132 -0
  38. data/lib/basecrm/services/tasks_service.rb +141 -0
  39. data/lib/basecrm/services/users_service.rb +83 -0
  40. data/lib/basecrm/version.rb +3 -0
  41. data/spec/factories/associated_contact.rb +14 -0
  42. data/spec/factories/contact.rb +27 -0
  43. data/spec/factories/deal.rb +17 -0
  44. data/spec/factories/lead.rb +26 -0
  45. data/spec/factories/loss_reason.rb +11 -0
  46. data/spec/factories/note.rb +13 -0
  47. data/spec/factories/source.rb +11 -0
  48. data/spec/factories/tag.rb +12 -0
  49. data/spec/factories/task.rb +15 -0
  50. data/spec/services/accounts_service_spec.rb +16 -0
  51. data/spec/services/associated_contacts_service_spec.rb +43 -0
  52. data/spec/services/contacts_service_spec.rb +58 -0
  53. data/spec/services/deals_service_spec.rb +58 -0
  54. data/spec/services/leads_service_spec.rb +58 -0
  55. data/spec/services/loss_reasons_service_spec.rb +58 -0
  56. data/spec/services/notes_service_spec.rb +58 -0
  57. data/spec/services/pipelines_service_spec.rb +23 -0
  58. data/spec/services/sources_service_spec.rb +58 -0
  59. data/spec/services/stages_service_spec.rb +23 -0
  60. data/spec/services/tags_service_spec.rb +58 -0
  61. data/spec/services/tasks_service_spec.rb +58 -0
  62. data/spec/services/users_service_spec.rb +39 -0
  63. data/spec/spec_helper.rb +24 -12
  64. data/spec/support/client_helpers.rb +19 -0
  65. metadata +160 -71
  66. data/.gitignore +0 -20
  67. data/.rspec +0 -2
  68. data/.travis.yml +0 -6
  69. data/Gemfile +0 -4
  70. data/Rakefile +0 -8
  71. data/basecrm.gemspec +0 -23
  72. data/lib/base_crm.rb +0 -24
  73. data/lib/base_crm/account.rb +0 -11
  74. data/lib/base_crm/api_client_ext.rb +0 -6
  75. data/lib/base_crm/config.rb +0 -21
  76. data/lib/base_crm/contact.rb +0 -44
  77. data/lib/base_crm/custom_fieldable.rb +0 -32
  78. data/lib/base_crm/deal.rb +0 -50
  79. data/lib/base_crm/forecasting.rb +0 -12
  80. data/lib/base_crm/lead.rb +0 -36
  81. data/lib/base_crm/note.rb +0 -15
  82. data/lib/base_crm/noteable.rb +0 -15
  83. data/lib/base_crm/related_object_scope.rb +0 -35
  84. data/lib/base_crm/resource.rb +0 -14
  85. data/lib/base_crm/session.rb +0 -48
  86. data/lib/base_crm/source.rb +0 -14
  87. data/lib/base_crm/task.rb +0 -16
  88. data/lib/base_crm/taskable.rb +0 -15
  89. data/lib/base_crm/version.rb +0 -3
  90. data/spec/base_crm/account_spec.rb +0 -20
  91. data/spec/base_crm/contact_spec.rb +0 -92
  92. data/spec/base_crm/deal_spec.rb +0 -138
  93. data/spec/base_crm/forecasting_spec.rb +0 -34
  94. data/spec/base_crm/lead_spec.rb +0 -63
  95. data/spec/base_crm/note_spec.rb +0 -20
  96. data/spec/base_crm/resource_mixin_spec.rb +0 -26
  97. data/spec/base_crm/session_spec.rb +0 -97
  98. data/spec/base_crm/source_spec.rb +0 -20
  99. data/spec/base_crm/task_spec.rb +0 -21
  100. data/spec/support/noteable_shared_examples.rb +0 -64
  101. data/spec/support/taskable_shared_examples.rb +0 -69
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40387841cc49a997c9ab264764fc79a56190881b
4
- data.tar.gz: e94fe87215b3f1302a80e87efbf6dee442989d8c
3
+ metadata.gz: 8112801481b6cff60fccc01b1218206447b30b35
4
+ data.tar.gz: b30ccfcdbfe04ea0a5b518c83e77d3d9c4631827
5
5
  SHA512:
6
- metadata.gz: 0eea26c5f63be7a738f7c12992c57695afb6031c34b9d4f4a7c8c309d6165cc15c26dfd7ab342543af18b083d7ba45a4a524b55b98d9292315a1133c841faa6d
7
- data.tar.gz: a0226695b2900d2d6ebc99e1a13d4e20f4189ed54be031571afd3c0e1a3c029f5f560b3de7a8b0c985448421b75c56e4a78df4d46c323b72e3982c61b88e38ef
6
+ metadata.gz: 492f991f87a6d464938ba7f1ab986571283103afa40a3fc6ee6e9a4d0475c7783a172193d09df6e9ad7f87c6c428a95103a08947d333247422749c5974a4305f
7
+ data.tar.gz: aaba445b34861708afebec9697d8eab35160f55b2ffe2f0ac34086ca682858e4c7ee1cb685cc8a9b46fe37a5ae0c397753c55d5dd85a93d07aa7fef0b921da7a
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Marcin Bunsch
1
+ Copyright (c) 2015 BaseCRM developers
2
2
 
3
3
  MIT License
4
4
 
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,18 +1,18 @@
1
- # Base CRM API client
1
+ # basecrm-ruby
2
2
 
3
- [![Build Status](https://travis-ci.org/basecrm/basecrm.png?branch=master)](https://travis-ci.org/basecrm/basecrm)
4
-
5
- New and shiny client for the Base CRM API
3
+ BaseCRM Official API V2 library client for ruby
6
4
 
7
5
  ## Installation
8
6
 
9
- The gem available via Rubygems. To install it, use the following command:
7
+ Make sure you have [rubygems](https://rubygems.org) installed.
8
+
9
+ The gem is available via Rubygems. To install, use the following command:
10
10
 
11
11
  ```ruby
12
12
  sudo gem install basecrm
13
13
  ```
14
14
 
15
- If you use Bundler, put this in your Gemfile:
15
+ If you use Bundler, put the line below in your Gemfile:
16
16
 
17
17
  ```ruby
18
18
  gem 'basecrm'
@@ -21,25 +21,281 @@ gem 'basecrm'
21
21
  To get the latest version, put this in your Gemfile:
22
22
 
23
23
  ```ruby
24
- gem 'basecrm', :git => 'git://github.com/basecrm/basecrm.git'
24
+ gem 'basecrm', :git => 'git://github.com/basecrm/basecrm-ruby.git'
25
25
  ```
26
26
 
27
27
  ## Usage
28
28
 
29
- Before using this gem you must require it by calling:
29
+ ```ruby
30
+ require "basecrm"
31
+
32
+ # Then we instantiate a client (as shown below)
33
+ ```
34
+
35
+ ### Build a client
36
+ __Using this api without authentication gives an error__
30
37
 
31
38
  ```ruby
32
- require 'basecrm'
39
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
33
40
  ```
34
41
 
35
- ## Usage
42
+ ### Client Options
43
+
44
+ The following options are available while instantiating a client:
45
+
46
+ * __access_token__: Personal access token
47
+ * __base_url__: Base url for the api
48
+ * __user_agent__: Default user-agent for all requests
49
+ * __timeout__: Request timeout
50
+ * __verbose__: Verbose/debug mode
51
+ * __logger__: Logger used in verbose mode
52
+
53
+ ### Architecture
54
+
55
+ The library follows few architectural principles you should understand before digging deeper.
56
+ 1. Interactions with resources are done via service objects.
57
+ 2. Service objects are exposed as methods on client instances.
58
+ 3. Service objects expose resource-oriented actions.
59
+ 4. Actions return Plain Old Ruby Objects.
60
+
61
+ For example, to interact with deals API you will use `DealsService`, which you can get if you call:
62
+
63
+ ```ruby
64
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
65
+ client.deals # => BaseCRM::DealsService
66
+ ```
67
+
68
+ When you want to fetch **all** resources you will use `#all` method which returns paginated resource (which implements Enumerable):
69
+
70
+ ```ruby
71
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
72
+ client.deals.all.map { |deal| deal.name } # => Array<String>
73
+ ```
74
+
75
+ To retrieve list of resources and use filtering you will call `#where` method:
76
+
77
+ ```ruby
78
+ client = BaseCRM::Client.new(accss_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
79
+ client.deals.where(organization_id: google.id, hot: true) # => Array<BaseCRM::Deal>
80
+ ```
81
+
82
+ To find a resource by it's unique identifier use `#find` method:
83
+
84
+ ```ruby
85
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
86
+ client.deals.find(id) # => BaseCRM::Deal
87
+ ```
88
+
89
+ When you'd like to create a resource, or update it's attributes you want to use either `#create` or `#update` methods. Both of them can take either Hash or a model class e.g. Deal instance. For example if you want to create a new deal you will call:
90
+
91
+ ```ruby
92
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
93
+ coffeeshop = client.contacts.where(name: "Coffee Shop")
94
+
95
+ deal = client.deals.create(name: "Website redesign", contact_id: coffeeshop.id)
96
+ deal.value = 1000
97
+ deal.currency = "USD"
98
+
99
+ client.deals.update(deal) # => BaseCRM::Deal
100
+ ```
101
+
102
+ To destroy a resource use `#destroy` method:
103
+
104
+ ```ruby
105
+ client = BaseCRM::Client.new(access_token: "<YOU_PERSONAL_ACCESS_TOKEN>")
106
+ client.deals.destroy(id) # => true
107
+ ```
108
+
109
+ There other non-CRUD operations supported as well. Please contact corresponding service files for in-depth documentation.
110
+
111
+ ### Full example
112
+
113
+ Create a new organization and after that change it's attributes (website).
114
+
115
+ ```ruby
116
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
117
+ lead = client.leads.create(organization_name: "Design service company")
118
+
119
+ lead.website = "http://www.designservices.com"
120
+ client.leads.update(lead)
121
+ ```
122
+
123
+ ## Resources and actions
124
+
125
+ Documentation for every action can be found in corresponding service files under `lib/basecrm/services` directory.
126
+
127
+ ### Account
128
+
129
+ ```ruby
130
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONL_ACCESS_TOKEN>")
131
+ client.accounts # => BaseCRM::AccountsService
132
+ ```
133
+
134
+ Actions:
135
+ * Retrieve account details - `client.accounts.self`
136
+
137
+ ### AssociatedContact
138
+
139
+ ```ruby
140
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONL_ACCESS_TOKEN>")
141
+ client.associated_contacts # => BaseCRM::AssociatedContactsService
142
+ ```
143
+
144
+ Actions:
145
+ * Retrieve deal's associated contacts - `client.associated_contacts.all`
146
+ * Create an associated contact - `client.associated_contacts.create`
147
+ * Remove an associated contact - `client.associated_contacts.destroy`
148
+
149
+ ### Contact
150
+
151
+ ```ruby
152
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONL_ACCESS_TOKEN>")
153
+ client.contacts # => BaseCRM::ContactsService
154
+ ```
155
+
156
+ Actions:
157
+ * Retrieve all contacts - `client.contacts.all`
158
+ * Create a contact - `client.contacts.create`
159
+ * Retrieve a single contact - `client.contacts.find`
160
+ * Update a contact - `client.contacts.update`
161
+ * Delete a contact - `client.contacts.destroy`
162
+
163
+ ### Deal
164
+
165
+ ```ruby
166
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONL_ACCESS_TOKEN>")
167
+ client.deals # => BaseCRM::DealsService
168
+ ```
169
+
170
+ Actions:
171
+ * Retrieve all deals - `client.deals.all`
172
+ * Create a deal - `client.deals.create`
173
+ * Retrieve a single deal - `client.deals.find`
174
+ * Update a deal - `client.deals.update`
175
+ * Delete a deal - `client.deals.destroy`
176
+
177
+ ### Lead
178
+
179
+ ```ruby
180
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONL_ACCESS_TOKEN>")
181
+ client.leads # => BaseCRM::LeadsService
182
+ ```
183
+
184
+ Actions:
185
+ * Retrieve all leads - `client.leads.all`
186
+ * Create a lead - `client.leads.create`
187
+ * Retrieve a single lead - `client.leads.find`
188
+ * Update a lead - `client.leads.update`
189
+ * Delete a lead - `client.leads.destroy`
190
+
191
+ ### LossReason
192
+
193
+ ```ruby
194
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONL_ACCESS_TOKEN>")
195
+ client.loss_reasons # => BaseCRM::LossReasonsService
196
+ ```
197
+
198
+ Actions:
199
+ * Retrieve all reasons - `client.loss_reasons.all`
200
+ * Create a loss reason - `client.loss_reasons.create`
201
+ * Retrieve a single reason - `client.loss_reasons.find`
202
+ * Update a loss reason - `client.loss_reasons.update`
203
+ * Delete a reason - `client.loss_reasons.destroy`
204
+
205
+ ### Note
206
+
207
+ ```ruby
208
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONL_ACCESS_TOKEN>")
209
+ client.notes # => BaseCRM::NotesService
210
+ ```
211
+
212
+ Actions:
213
+ * Retrieve all notes - `client.notes.all`
214
+ * Create a note - `client.notes.create`
215
+ * Retrieve a single note - `client.notes.find`
216
+ * Update a note - `client.notes.update`
217
+ * Delete a note - `client.notes.destroy`
218
+
219
+ ### Pipeline
220
+
221
+ ```ruby
222
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONL_ACCESS_TOKEN>")
223
+ client.pipelines # => BaseCRM::PipelinesService
224
+ ```
225
+
226
+ Actions:
227
+ * Retrieve all pipelines - `client.pipelines.all`
228
+
229
+ ### Source
230
+
231
+ ```ruby
232
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONL_ACCESS_TOKEN>")
233
+ client.sources # => BaseCRM::SourcesService
234
+ ```
235
+
236
+ Actions:
237
+ * Retrieve all sources - `client.sources.all`
238
+ * Create a source - `client.sources.create`
239
+ * Retrieve a single source - `client.sources.find`
240
+ * Update a source - `client.sources.update`
241
+ * Delete a source - `client.sources.destroy`
242
+
243
+ ### Stage
244
+
245
+ ```ruby
246
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONL_ACCESS_TOKEN>")
247
+ client.stages # => BaseCRM::StagesService
248
+ ```
249
+
250
+ Actions:
251
+ * Retrieve all stages - `client.stages.all`
252
+
253
+ ### Tag
254
+
255
+ ```ruby
256
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONL_ACCESS_TOKEN>")
257
+ client.tags # => BaseCRM::TagsService
258
+ ```
259
+
260
+ Actions:
261
+ * Retrieve all tags - `client.tags.all`
262
+ * Create a tag - `client.tags.create`
263
+ * Retrieve a single tag - `client.tags.find`
264
+ * Update a tag - `client.tags.update`
265
+ * Delete a tag - `client.tags.destroy`
266
+
267
+ ### Task
268
+
269
+ ```ruby
270
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONL_ACCESS_TOKEN>")
271
+ client.tasks # => BaseCRM::TasksService
272
+ ```
273
+
274
+ Actions:
275
+ * Retrieve all tasks - `client.tasks.all`
276
+ * Create a task - `client.tasks.create`
277
+ * Retrieve a single task - `client.tasks.find`
278
+ * Update a task - `client.tasks.update`
279
+ * Delete a task - `client.tasks.destroy`
280
+
281
+ ### User
282
+
283
+ ```ruby
284
+ client = BaseCRM::Client.new(access_token: "<YOUR_PERSONL_ACCESS_TOKEN>")
285
+ client.users # => BaseCRM::UsersService
286
+ ```
287
+
288
+ Actions:
289
+ * Retrieve all users - `client.users.all`
290
+ * Retrieve a single user - `client.users.find`
291
+ * Retrieve an authenticating user - `client.users.self`
292
+
36
293
 
37
- TODO: Write usage instructions here
294
+ ## License
295
+ MIT
38
296
 
39
- ## Contributing
297
+ ## Bug Reports
298
+ Report [here](https://github.com/basecrm/basecrm-ruby/issues).
40
299
 
41
- 1. Fork it
42
- 2. Create your feature branch (`git checkout -b my-new-feature`)
43
- 3. Commit your changes (`git commit -am 'Added some feature'`)
44
- 4. Push to the branch (`git push origin my-new-feature`)
45
- 5. Create new Pull Request
300
+ ## Contact
301
+ BaseCRM developers (developers@getbase.com)
data/lib/basecrm.rb CHANGED
@@ -1,2 +1,186 @@
1
- require "base_crm"
1
+ require 'json'
2
+ require 'faraday'
2
3
 
4
+ require 'basecrm/version'
5
+ require 'basecrm/errors'
6
+ require 'basecrm/envelope'
7
+ require 'basecrm/configuration'
8
+ require 'basecrm/http_client'
9
+
10
+ require 'basecrm/model'
11
+ require 'basecrm/models/account'
12
+ require 'basecrm/models/address'
13
+ require 'basecrm/models/associated_contact'
14
+ require 'basecrm/models/contact'
15
+ require 'basecrm/models/deal'
16
+ require 'basecrm/models/lead'
17
+ require 'basecrm/models/loss_reason'
18
+ require 'basecrm/models/note'
19
+ require 'basecrm/models/pipeline'
20
+ require 'basecrm/models/source'
21
+ require 'basecrm/models/stage'
22
+ require 'basecrm/models/tag'
23
+ require 'basecrm/models/task'
24
+ require 'basecrm/models/user'
25
+
26
+ require 'basecrm/paginated_resource'
27
+ require 'basecrm/services/accounts_service'
28
+ require 'basecrm/services/associated_contacts_service'
29
+ require 'basecrm/services/contacts_service'
30
+ require 'basecrm/services/deals_service'
31
+ require 'basecrm/services/leads_service'
32
+ require 'basecrm/services/loss_reasons_service'
33
+ require 'basecrm/services/notes_service'
34
+ require 'basecrm/services/pipelines_service'
35
+ require 'basecrm/services/sources_service'
36
+ require 'basecrm/services/stages_service'
37
+ require 'basecrm/services/tags_service'
38
+ require 'basecrm/services/tasks_service'
39
+ require 'basecrm/services/users_service'
40
+
41
+ module BaseCRM
42
+ class Client
43
+ attr_reader :config
44
+ attr_reader :http_client
45
+
46
+ # Instantiate a new BaseCRM API V2 client
47
+ #
48
+ # @param options [Hash] Client options
49
+ # @option options [String] :access_token Personal access token
50
+ # @option options [String] :base_url (https://api.getbase.com) Base url for the api
51
+ # @option options [String] :use_agent (BaseCRM/v2 Ruby/{Version}) Client user agent
52
+ # @option options [Integer] :timeout (30) Request timeout
53
+ # @option options [Boolean] :verbose (false) Verbose/debug mode
54
+ # @option options [Logger] :logger (STDOUT) Logged used in verbose mode
55
+ #
56
+ # @raise [ConfigurationError] if no access token provided
57
+ # @raise [ConfigurationError] if provided access token is invalid - contains disallowed characters
58
+ # @raise [ConfigurationError] if provided access token is invalid - has invalid length
59
+ # @raise [ConfigurationError] if provided base url is invalid
60
+ #
61
+ # @return [Client] New client
62
+ def initialize(options={})
63
+ @config = Configuration.new(options)
64
+ @config.validate!
65
+
66
+ @http_client = HttpClient.new(@config)
67
+ end
68
+
69
+ # Access all Accounts related actions.
70
+ # @see AccountsService
71
+ # @see Account
72
+ #
73
+ # @return [AccountsService] Service object for resources.
74
+ def accounts
75
+ @accounts ||= AccountsService.new(@http_client)
76
+ end
77
+
78
+ # Access all AssociatedContacts related actions.
79
+ # @see AssociatedContactsService
80
+ # @see AssociatedContact
81
+ #
82
+ # @return [AssociatedContactsService] Service object for resources.
83
+ def associated_contacts
84
+ @associated_contacts ||= AssociatedContactsService.new(@http_client)
85
+ end
86
+
87
+ # Access all Contacts related actions.
88
+ # @see ContactsService
89
+ # @see Contact
90
+ #
91
+ # @return [ContactsService] Service object for resources.
92
+ def contacts
93
+ @contacts ||= ContactsService.new(@http_client)
94
+ end
95
+
96
+ # Access all Deals related actions.
97
+ # @see DealsService
98
+ # @see Deal
99
+ #
100
+ # @return [DealsService] Service object for resources.
101
+ def deals
102
+ @deals ||= DealsService.new(@http_client)
103
+ end
104
+
105
+ # Access all Leads related actions.
106
+ # @see LeadsService
107
+ # @see Lead
108
+ #
109
+ # @return [LeadsService] Service object for resources.
110
+ def leads
111
+ @leads ||= LeadsService.new(@http_client)
112
+ end
113
+
114
+ # Access all LossReasons related actions.
115
+ # @see LossReasonsService
116
+ # @see LossReason
117
+ #
118
+ # @return [LossReasonsService] Service object for resources.
119
+ def loss_reasons
120
+ @loss_reasons ||= LossReasonsService.new(@http_client)
121
+ end
122
+
123
+ # Access all Notes related actions.
124
+ # @see NotesService
125
+ # @see Note
126
+ #
127
+ # @return [NotesService] Service object for resources.
128
+ def notes
129
+ @notes ||= NotesService.new(@http_client)
130
+ end
131
+
132
+ # Access all Pipelines related actions.
133
+ # @see PipelinesService
134
+ # @see Pipeline
135
+ #
136
+ # @return [PipelinesService] Service object for resources.
137
+ def pipelines
138
+ @pipelines ||= PipelinesService.new(@http_client)
139
+ end
140
+
141
+ # Access all Sources related actions.
142
+ # @see SourcesService
143
+ # @see Source
144
+ #
145
+ # @return [SourcesService] Service object for resources.
146
+ def sources
147
+ @sources ||= SourcesService.new(@http_client)
148
+ end
149
+
150
+ # Access all Stages related actions.
151
+ # @see StagesService
152
+ # @see Stage
153
+ #
154
+ # @return [StagesService] Service object for resources.
155
+ def stages
156
+ @stages ||= StagesService.new(@http_client)
157
+ end
158
+
159
+ # Access all Tags related actions.
160
+ # @see TagsService
161
+ # @see Tag
162
+ #
163
+ # @return [TagsService] Service object for resources.
164
+ def tags
165
+ @tags ||= TagsService.new(@http_client)
166
+ end
167
+
168
+ # Access all Tasks related actions.
169
+ # @see TasksService
170
+ # @see Task
171
+ #
172
+ # @return [TasksService] Service object for resources.
173
+ def tasks
174
+ @tasks ||= TasksService.new(@http_client)
175
+ end
176
+
177
+ # Access all Users related actions.
178
+ # @see UsersService
179
+ # @see User
180
+ #
181
+ # @return [UsersService] Service object for resources.
182
+ def users
183
+ @users ||= UsersService.new(@http_client)
184
+ end
185
+ end
186
+ end