Skip to content

Commit d732baf

Browse files
author
Erwin Fedasz
authored
Merge pull request #51 from basecrm/v1.3.0
V1.3.0
2 parents 3b99d5a + 2c9b652 commit d732baf

30 files changed

Lines changed: 1359 additions & 31 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## CHANGELOG
22

3+
v1.3.0 (2017-10-19)
4+
**Features and Improvements**
5+
6+
* Added new models support: LeadSource, DealSource, Product, Order, LineItem
7+
* Deal model update, added estimated_close_date and customized_win_likelihood
8+
39
v1.2.3 (2017-10-02)
410
**Features and Improvements**
511

README.md

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,20 @@ You should not be using floats as it may result in precision loss.
216216
deal.value = 1000.98
217217
```
218218

219+
### DealSource
220+
221+
```ruby
222+
client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
223+
client.deal_sources # => BaseCRM::DealSourcesService
224+
```
225+
226+
Actions:
227+
* Retrieve all sources - `client.deal_sources.all`
228+
* Create a new source - `client.deal_sources.create`
229+
* Retrieve a single source - `client.deal_sources.find`
230+
* Update a source - `client.deal_sources.update`
231+
* Delete a source - `client.deal_sources.destroy`
232+
219233
### Lead
220234

221235
```ruby
@@ -230,6 +244,33 @@ Actions:
230244
* Update a lead - `client.leads.update`
231245
* Delete a lead - `client.leads.destroy`
232246

247+
### LeadSource
248+
249+
```ruby
250+
client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
251+
client.lead_sources # => BaseCRM::LeadSourcesService
252+
```
253+
254+
Actions:
255+
* Retrieve all sources - `client.lead_sources.all`
256+
* Create a new source - `client.lead_sources.create`
257+
* Retrieve a single source - `client.lead_sources.find`
258+
* Update a source - `client.lead_sources.update`
259+
* Delete a source - `client.lead_sources.destroy`
260+
261+
### LineItem
262+
263+
```ruby
264+
client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
265+
client.line_items # => BaseCRM::LineItemsService
266+
```
267+
268+
Actions:
269+
* Retrieve order's line items - `client.line_items.all`
270+
* Create a line item - `client.line_items.create`
271+
* Retrieve a single line item - `client.line_items.find`
272+
* Delete a line item - `client.line_items.destroy`
273+
233274
### LossReason
234275

235276
```ruby
@@ -258,6 +299,20 @@ Actions:
258299
* Update a note - `client.notes.update`
259300
* Delete a note - `client.notes.destroy`
260301

302+
### Order
303+
304+
```ruby
305+
client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
306+
client.orders # => BaseCRM::OrdersService
307+
```
308+
309+
Actions:
310+
* Retrieve all orders - `client.orders.all`
311+
* Create an order - `client.orders.create`
312+
* Retrieve a single order - `client.orders.find`
313+
* Update an order - `client.orders.update`
314+
* Delete an order - `client.orders.destroy`
315+
261316
### Pipeline
262317

263318
```ruby
@@ -268,7 +323,21 @@ client.pipelines # => BaseCRM::PipelinesService
268323
Actions:
269324
* Retrieve all pipelines - `client.pipelines.all`
270325

271-
### Source
326+
### Product
327+
328+
```ruby
329+
client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
330+
client.products # => BaseCRM::ProductsService
331+
```
332+
333+
Actions:
334+
* Retrieve all products - `client.products.all`
335+
* Create a product - `client.products.create`
336+
* Retrieve a single product - `client.products.find`
337+
* Update a product - `client.products.update`
338+
* Delete a product - `client.products.destroy`
339+
340+
### Source (Deprecated, use LeadSource or DealSource instead)
272341

273342
```ruby
274343
client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.3
1+
1.3.0

lib/basecrm.rb

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
require 'basecrm/configuration'
88
require 'basecrm/http_client'
99

10-
require 'basecrm/utils/coercion.rb'
10+
require 'basecrm/utils/coercion'
1111

1212
require 'basecrm/model'
1313
require 'basecrm/models/meta'
@@ -16,10 +16,16 @@
1616
require 'basecrm/models/associated_contact'
1717
require 'basecrm/models/contact'
1818
require 'basecrm/models/deal'
19+
require 'basecrm/models/deal_source'
1920
require 'basecrm/models/lead'
21+
require 'basecrm/models/lead_source'
22+
require 'basecrm/models/line_item'
2023
require 'basecrm/models/loss_reason'
2124
require 'basecrm/models/note'
25+
require 'basecrm/models/order'
2226
require 'basecrm/models/pipeline'
27+
require 'basecrm/models/price'
28+
require 'basecrm/models/product'
2329
require 'basecrm/models/source'
2430
require 'basecrm/models/stage'
2531
require 'basecrm/models/tag'
@@ -34,10 +40,15 @@
3440
require 'basecrm/services/associated_contacts_service'
3541
require 'basecrm/services/contacts_service'
3642
require 'basecrm/services/deals_service'
43+
require 'basecrm/services/deal_sources_service'
3744
require 'basecrm/services/leads_service'
45+
require 'basecrm/services/lead_sources_service'
46+
require 'basecrm/services/line_items_service'
3847
require 'basecrm/services/loss_reasons_service'
3948
require 'basecrm/services/notes_service'
49+
require 'basecrm/services/orders_service'
4050
require 'basecrm/services/pipelines_service'
51+
require 'basecrm/services/products_service'
4152
require 'basecrm/services/sources_service'
4253
require 'basecrm/services/stages_service'
4354
require 'basecrm/services/tags_service'
@@ -111,6 +122,15 @@ def deals
111122
@deals ||= DealsService.new(@http_client)
112123
end
113124

125+
# Access all DealSources related actions.
126+
# @see DealSourcesService
127+
# @see DealSource
128+
#
129+
# @return [DealSourcesService] Service object for resources.
130+
def deal_sources
131+
@deal_sources ||= DealSourcesService.new(@http_client)
132+
end
133+
114134
# Access all Leads related actions.
115135
# @see LeadsService
116136
# @see Lead
@@ -120,6 +140,24 @@ def leads
120140
@leads ||= LeadsService.new(@http_client)
121141
end
122142

143+
# Access all LeadSources related actions.
144+
# @see LeadSourcesService
145+
# @see LeadSource
146+
#
147+
# @return [LeadSourcesService] Service object for resources.
148+
def lead_sources
149+
@lead_sources ||= LeadSourcesService.new(@http_client)
150+
end
151+
152+
# Access all LineItems related actions.
153+
# @see LineItemsService
154+
# @see LineItem
155+
#
156+
# @return [LineItemsService] Service object for resources.
157+
def line_items
158+
@line_items ||= LineItemsService.new(@http_client)
159+
end
160+
123161
# Access all LossReasons related actions.
124162
# @see LossReasonsService
125163
# @see LossReason
@@ -138,6 +176,15 @@ def notes
138176
@notes ||= NotesService.new(@http_client)
139177
end
140178

179+
# Access all Orders related actions.
180+
# @see OrdersService
181+
# @see Order
182+
#
183+
# @return [OrdersService] Service object for resources.
184+
def orders
185+
@orders ||= OrdersService.new(@http_client)
186+
end
187+
141188
# Access all Pipelines related actions.
142189
# @see PipelinesService
143190
# @see Pipeline
@@ -147,6 +194,15 @@ def pipelines
147194
@pipelines ||= PipelinesService.new(@http_client)
148195
end
149196

197+
# Access all Products related actions.
198+
# @see ProductsService
199+
# @see Product
200+
#
201+
# @return [ProductsService] Service object for resources.
202+
def products
203+
@products ||= ProductsService.new(@http_client)
204+
end
205+
150206
# Access all Sources related actions.
151207
# @see SourcesService
152208
# @see Source

lib/basecrm/models/deal.rb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,18 @@ class Deal < Model
88
# @!attribute [r] creator_id
99
# @return [Integer] Unique identifier of the user who created the deal.
1010
# attr_reader :creator_id
11+
# @!attribute [r] dropbox_email
12+
# @return [String] Dropbox email connected with the deal.
13+
# attr_reader :dropbox_email
1114
# @!attribute [r] id
1215
# @return [Integer] Unique identifier of the deal.
1316
# attr_reader :id
17+
# @!attribute [r] last_stage_change_at
18+
# @return [DateTime] Date and time when the deal was moved into the current stage in UTC (ISO8601 format).
19+
# attr_reader :last_stage_change_at
20+
# @!attribute [r] last_stage_change_by_id
21+
# @return [Integer] Unique identifier of the user who moved the deal into the current stage.
22+
# attr_reader :last_stage_change_by_id
1423
# @!attribute [r] organization_id
1524
# @return [Integer] Unique identifier of an organization.
1625
# attr_reader :organization_id
@@ -27,9 +36,12 @@ class Deal < Model
2736
# @!attribute [rw] custom_fields
2837
# @return [Hash] Custom fields are key-value data attached to a deal. See more at [Custom Fields](/docs/rest/articles/requests#custom_fields).
2938
# attr_accessor :custom_fields
30-
# @!attribute [rw] dropbox_email
31-
# @return [String] Dropbox email connected with the deal.
32-
# attr_accessor :dropbox_email
39+
# @!attribute [rw] customized_win_likelihood
40+
# @return [Integer] User-provided win likelihood with value range 0–100.
41+
# attr_accessor :customized_win_likelihood
42+
# @!attribute [rw] estimated_close_date
43+
# @return [String] Estimated close date of the deal
44+
# attr_accessor :estimated_close_date
3345
# @!attribute [rw] hot
3446
# @return [Boolean] Indicator of whether or not the deal is hot.
3547
# attr_accessor :hot

lib/basecrm/models/deal_source.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# WARNING: This code is auto-generated from the BaseCRM API Discovery JSON Schema
2+
3+
module BaseCRM
4+
class DealSource < Model
5+
# @!attribute [r] created_at
6+
# @return [String] Date and time of creation in UTC (ISO 8601 format).
7+
# attr_reader :created_at
8+
# @!attribute [r] creator_id
9+
# @return [Integer] Unique identifier of the user that created the source.
10+
# attr_reader :creator_id
11+
# @!attribute [r] id
12+
# @return [Integer] Unique identifier of the deal source.
13+
# attr_reader :id
14+
# @!attribute [r] updated_at
15+
# @return [String] Date and time of the last update in UTC (ISO 8601 format).
16+
# attr_reader :updated_at
17+
18+
# @!attribute [rw] name
19+
# @return [String] Name of the source.
20+
# attr_accessor :name
21+
# @!attribute [rw] resource_type
22+
# @return [String] Type name of the resource the source is attached to. Possible values: deal
23+
# attr_accessor :resource_type
24+
end
25+
end

lib/basecrm/models/lead_source.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# WARNING: This code is auto-generated from the BaseCRM API Discovery JSON Schema
2+
3+
module BaseCRM
4+
class LeadSource < Model
5+
# @!attribute [r] created_at
6+
# @return [String] Date and time of creation in UTC (ISO 8601 format).
7+
# attr_reader :created_at
8+
# @!attribute [r] creator_id
9+
# @return [Integer] Unique identifier of the user that created the source.
10+
# attr_reader :creator_id
11+
# @!attribute [r] id
12+
# @return [Integer] Unique identifier of the lead source.
13+
# attr_reader :id
14+
# @!attribute [r] updated_at
15+
# @return [String] Date and time of the last update in UTC (ISO 8601 format).
16+
# attr_reader :updated_at
17+
18+
# @!attribute [rw] name
19+
# @return [String] Name of the source.
20+
# attr_accessor :name
21+
# @!attribute [rw] resource_type
22+
# @return [String] Type name of the resource the source is attached to. Possible values: lead
23+
# attr_accessor :resource_type
24+
end
25+
end

lib/basecrm/models/line_item.rb

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# WARNING: This code is auto-generated from the BaseCRM API Discovery JSON Schema
2+
3+
module BaseCRM
4+
class LineItem < Model
5+
# @!attribute [r] id
6+
# @return [Integer] Unique identifier of the line item.
7+
# attr_reader :id
8+
# @!attribute [r] name
9+
# @return [String] Name of the product. Value is copied from the product.
10+
# attr_reader :name
11+
# @!attribute [r] sku
12+
# @return [String] Stock Keeping Unit identification code. Value is copied from the product.
13+
# attr_reader :sku
14+
# @!attribute [r] description
15+
# @return [String] Description of the product. Value is copied from the product.
16+
# attr_reader :description
17+
# @!attribute [r] created_at
18+
# @return [DateTime] Date and time that the line item was created in UTC (ISO8601 format).
19+
# attr_reader :created_at
20+
# @!attribute [r] updated_at
21+
# @return [DateTime] Date and time of the last update on the line item in UTC (ISO8601 format).
22+
# attr_reader :updated_at
23+
24+
# @!attribute [rw] product_id
25+
# @return [Integer] Unique identifier of the product based on which line item is created. It is not available after creation.
26+
# attr_accessor :product_id
27+
# @!attribute [rw] value
28+
# @return [Integer] Value of one unit of the product. It is product’s price after applying markup.
29+
# attr_accessor :value
30+
# @!attribute [rw] variation
31+
# @return [Integer] Variation of the product’s price for this line item. Value of 5 means that 5% markup is added, -10 means there is a 10% discount.
32+
# attr_accessor :variation
33+
# @!attribute [rw] currency
34+
# @return [String] Currency of value and price, specified in 3-character currency code (ISO4217) format.
35+
# attr_accessor :currency
36+
# @!attribute [rw] quantity
37+
# @return [Integer] Quantity of the product included in this line item. Default value is 1.
38+
# attr_accessor :quantity
39+
# @!attribute [rw] price
40+
# @return [Integer] Price of one unit of the product. Value is copied from the product.
41+
# attr_accessor :price
42+
end
43+
end

lib/basecrm/models/order.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# WARNING: This code is auto-generated from the BaseCRM API Discovery JSON Schema
2+
3+
module BaseCRM
4+
class Order < Model
5+
# @!attribute [r] id
6+
# @return [Integer] Unique identifier of the order.
7+
# attr_reader :id
8+
# @!attribute [r] created_at
9+
# @return [DateTime] Date and time that the order was created in UTC (ISO8601 format).
10+
# attr_reader :created_at
11+
# @!attribute [r] updated_at
12+
# @return [DateTime] Date and time of the last update on the order in UTC (ISO8601 format).
13+
# attr_reader :updated_at
14+
15+
# @!attribute [rw] deal_id
16+
# @return [Integer] ID of the deal the order is associated to.
17+
# attr_accessor :deal_id
18+
# @!attribute [rw] discount
19+
# @return [Integer] Discount on the whole order in percents.
20+
# attr_accessor :discount
21+
end
22+
end

lib/basecrm/models/price.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# WARNING: This code is auto-generated from the BaseCRM API Discovery JSON Schema
2+
3+
module BaseCRM
4+
class Price < Model
5+
6+
# @!attribute [rw] amount
7+
# @return [Integer] Price amount
8+
# attr_accessor :amount
9+
# @!attribute [rw] currency
10+
# @return [String] Price currency
11+
# attr_accessor :currency
12+
end
13+
end

0 commit comments

Comments
 (0)