basecrm 1.2.3 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0b22919c8d438aa9b4da0f1aaa32c2036b44940
4
- data.tar.gz: e40c299088f7f4571d2603bfc493615e4d30ea7d
3
+ metadata.gz: b8926293016d60459867e6e9ebf95d981b4c05b1
4
+ data.tar.gz: b1893e2462cd97f6133945ac6ee2bea1586317b6
5
5
  SHA512:
6
- metadata.gz: c96aa403415298f79e1ddd8fe519ef42be3fe1aec5c6ed8d464b7293ba778b5ee9388ca60e249a315dc860685afca21a13545f8cb65042abb5abb7b0912eb6f2
7
- data.tar.gz: 32d7764d318c2bffcd01efa4496b8a290ced851b1c9cd793e3893ba8ee91c6cb11418dca824801f8ddaade87899f2b3ebc260aacc6c8bd8b9ea62c8f69d18067
6
+ metadata.gz: 27725431587ba2b68687a559ad14efdcb7bd64d45232102e26708cbd967983c2d5612cf88f486db172071fdee1675f2a20f224185f05cf58ac53e0b76f157b5f
7
+ data.tar.gz: e86129dcf65d434cfecbd98a664e36e9125d84356efc2b8ebbfe979fe2256dfc832ef9455d8dfbc59d33fcd7348783e3253a62c43b420747597e3760a3dc1178
data/README.md CHANGED
@@ -216,6 +216,20 @@ You should not be using floats as it may result in precision loss.
216
216
  deal.value = 1000.98
217
217
  ```
218
218
 
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
+
219
233
  ### Lead
220
234
 
221
235
  ```ruby
@@ -230,6 +244,33 @@ Actions:
230
244
  * Update a lead - `client.leads.update`
231
245
  * Delete a lead - `client.leads.destroy`
232
246
 
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
+
233
274
  ### LossReason
234
275
 
235
276
  ```ruby
@@ -258,6 +299,20 @@ Actions:
258
299
  * Update a note - `client.notes.update`
259
300
  * Delete a note - `client.notes.destroy`
260
301
 
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
+
261
316
  ### Pipeline
262
317
 
263
318
  ```ruby
@@ -268,7 +323,21 @@ client.pipelines # => BaseCRM::PipelinesService
268
323
  Actions:
269
324
  * Retrieve all pipelines - `client.pipelines.all`
270
325
 
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)
272
341
 
273
342
  ```ruby
274
343
  client = BaseCRM::Client.new(access_token: "<YOUR_PERSONAL_ACCESS_TOKEN>")
data/lib/basecrm.rb CHANGED
@@ -7,7 +7,7 @@ require 'basecrm/envelope'
7
7
  require 'basecrm/configuration'
8
8
  require 'basecrm/http_client'
9
9
 
10
- require 'basecrm/utils/coercion.rb'
10
+ require 'basecrm/utils/coercion'
11
11
 
12
12
  require 'basecrm/model'
13
13
  require 'basecrm/models/meta'
@@ -16,10 +16,16 @@ require 'basecrm/models/address'
16
16
  require 'basecrm/models/associated_contact'
17
17
  require 'basecrm/models/contact'
18
18
  require 'basecrm/models/deal'
19
+ require 'basecrm/models/deal_source'
19
20
  require 'basecrm/models/lead'
21
+ require 'basecrm/models/lead_source'
22
+ require 'basecrm/models/line_item'
20
23
  require 'basecrm/models/loss_reason'
21
24
  require 'basecrm/models/note'
25
+ require 'basecrm/models/order'
22
26
  require 'basecrm/models/pipeline'
27
+ require 'basecrm/models/price'
28
+ require 'basecrm/models/product'
23
29
  require 'basecrm/models/source'
24
30
  require 'basecrm/models/stage'
25
31
  require 'basecrm/models/tag'
@@ -34,10 +40,15 @@ require 'basecrm/services/accounts_service'
34
40
  require 'basecrm/services/associated_contacts_service'
35
41
  require 'basecrm/services/contacts_service'
36
42
  require 'basecrm/services/deals_service'
43
+ require 'basecrm/services/deal_sources_service'
37
44
  require 'basecrm/services/leads_service'
45
+ require 'basecrm/services/lead_sources_service'
46
+ require 'basecrm/services/line_items_service'
38
47
  require 'basecrm/services/loss_reasons_service'
39
48
  require 'basecrm/services/notes_service'
49
+ require 'basecrm/services/orders_service'
40
50
  require 'basecrm/services/pipelines_service'
51
+ require 'basecrm/services/products_service'
41
52
  require 'basecrm/services/sources_service'
42
53
  require 'basecrm/services/stages_service'
43
54
  require 'basecrm/services/tags_service'
@@ -111,6 +122,15 @@ module BaseCRM
111
122
  @deals ||= DealsService.new(@http_client)
112
123
  end
113
124
 
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
+
114
134
  # Access all Leads related actions.
115
135
  # @see LeadsService
116
136
  # @see Lead
@@ -120,6 +140,24 @@ module BaseCRM
120
140
  @leads ||= LeadsService.new(@http_client)
121
141
  end
122
142
 
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
+
123
161
  # Access all LossReasons related actions.
124
162
  # @see LossReasonsService
125
163
  # @see LossReason
@@ -138,6 +176,15 @@ module BaseCRM
138
176
  @notes ||= NotesService.new(@http_client)
139
177
  end
140
178
 
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
+
141
188
  # Access all Pipelines related actions.
142
189
  # @see PipelinesService
143
190
  # @see Pipeline
@@ -147,6 +194,15 @@ module BaseCRM
147
194
  @pipelines ||= PipelinesService.new(@http_client)
148
195
  end
149
196
 
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
+
150
206
  # Access all Sources related actions.
151
207
  # @see SourcesService
152
208
  # @see Source
@@ -8,9 +8,18 @@ module BaseCRM
8
8
  # @!attribute [r] creator_id
9
9
  # @return [Integer] Unique identifier of the user who created the deal.
10
10
  # attr_reader :creator_id
11
+ # @!attribute [r] dropbox_email
12
+ # @return [String] Dropbox email connected with the deal.
13
+ # attr_reader :dropbox_email
11
14
  # @!attribute [r] id
12
15
  # @return [Integer] Unique identifier of the deal.
13
16
  # 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
14
23
  # @!attribute [r] organization_id
15
24
  # @return [Integer] Unique identifier of an organization.
16
25
  # attr_reader :organization_id
@@ -27,9 +36,12 @@ module BaseCRM
27
36
  # @!attribute [rw] custom_fields
28
37
  # @return [Hash] Custom fields are key-value data attached to a deal. See more at [Custom Fields](/docs/rest/articles/requests#custom_fields).
29
38
  # 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
33
45
  # @!attribute [rw] hot
34
46
  # @return [Boolean] Indicator of whether or not the deal is hot.
35
47
  # attr_accessor :hot
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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,0 +1,43 @@
1
+ # WARNING: This code is auto-generated from the BaseCRM API Discovery JSON Schema
2
+
3
+ module BaseCRM
4
+ class Product < Model
5
+ # @!attribute [r] id
6
+ # @return [Integer] Unique identifier of the product.
7
+ # attr_reader :id
8
+ # @!attribute [r] created_at
9
+ # @return [DateTime] Date and time that the product 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 product in UTC (ISO8601 format).
13
+ # attr_reader :updated_at
14
+
15
+ # @!attribute [rw] name
16
+ # @return [String] Name of the product.
17
+ # attr_accessor :name
18
+ # @!attribute [rw] description
19
+ # @return [String] Description of the product.
20
+ # attr_accessor :description
21
+ # @!attribute [rw] sku
22
+ # @return [String] Stock Keeping Unit identification code.
23
+ # attr_accessor :sku
24
+ # @!attribute [rw] active
25
+ # @return [Boolean] Indicator of whether the product is active. Line items cannot be created from inactive products.
26
+ # attr_accessor :active
27
+ # @!attribute [rw] max_discount
28
+ # @return [Integer] Maximum discount that can be applied to the product in percents.
29
+ # attr_accessor :max_discount
30
+ # @!attribute [rw] max_markup
31
+ # @return [Integer] Maximum markup that can be applied to the product in percents.
32
+ # attr_accessor :max_markup
33
+ # @!attribute [rw] cost
34
+ # @return [Integer] Cost of the product. Visible only to account administrators.
35
+ # attr_accessor :cost
36
+ # @!attribute [rw] cost_currency
37
+ # @return [String] Currency of the product cost, specified in 3-character currency code (ISO4217) format. Visible only to account administrators.
38
+ # attr_accessor :cost_currency
39
+ # @!attribute [rw] prices
40
+ # @return [Array<Price>] Array specifying products prices in different currencies.
41
+ # attr_accessor :prices
42
+ end
43
+ end
@@ -0,0 +1,133 @@
1
+ # WARNING: This code is auto-generated from the BaseCRM API Discovery JSON Schema
2
+
3
+ module BaseCRM
4
+ class DealSourcesService
5
+ OPTS_KEYS_TO_PERSIST = Set[:name, :resource_type]
6
+
7
+ def initialize(client)
8
+ @client = client
9
+ end
10
+
11
+ # Retrieve all sources
12
+ #
13
+ # get '/deal_sources'
14
+ #
15
+ # If you want to use filtering or sorting (see #where).
16
+ # @return [Enumerable] Paginated resource you can use to iterate over all the resources.
17
+ def all
18
+ PaginatedResource.new(self)
19
+ end
20
+
21
+ # Retrieve all sources
22
+ #
23
+ # get '/deal_sources'
24
+ #
25
+ # Returns all deal sources available to the user according to the parameters provided
26
+ #
27
+ # @param options [Hash] Search options
28
+ # @option options [String] :ids Comma-separated list of deal source IDs to be returned in a request.
29
+ # @option options [String] :name Name of the source to search for. This parameter is used in a strict sense.
30
+ # @option options [Integer] :page (1) Page number to start from. Page numbering starts at 1, and omitting the `page` parameter will return the first page.
31
+ # @option options [Integer] :per_page (25) Number of records to return per page. The default limit is *25* and the maximum number that can be returned is *100*.
32
+ # @option options [String] :sort_by (id:asc) A field to sort by. The **default** ordering is **ascending**. If you want to change the sort order to descending, append `:desc` to the field e.g. `sort_by=name:desc`.
33
+ # @return [Array<DealSource>] The list of DealSources for the first page, unless otherwise specified.
34
+ def where(options = {})
35
+ _, _, root = @client.get("/deal_sources", options)
36
+
37
+ root[:items].map{ |item| DealSource.new(item[:data]) }
38
+ end
39
+
40
+
41
+ # Create a new source
42
+ #
43
+ # post '/deal_sources'
44
+ #
45
+ # Creates a new source
46
+ # <figure class="notice">
47
+ # Source's name **must** be unique
48
+ # </figure>
49
+ #
50
+ # @param deal_source [DealSource, Hash] Either object of the DealSource type or Hash. This object's attributes describe the object to be created.
51
+ # @return [DealSource] The resulting object represting created resource.
52
+ def create(deal_source)
53
+ validate_type!(deal_source)
54
+
55
+ attributes = sanitize(deal_source)
56
+ _, _, root = @client.post("/deal_sources", attributes)
57
+
58
+ DealSource.new(root[:data])
59
+ end
60
+
61
+
62
+ # Retrieve a single source
63
+ #
64
+ # get '/deal_sources/{id}'
65
+ #
66
+ # Returns a single source available to the user by the provided id
67
+ # If a source with the supplied unique identifier does not exist it returns an error
68
+ #
69
+ # @param id [Integer] Unique identifier of a DealSource
70
+ # @return [DealSource] Searched resource object.
71
+ def find(id)
72
+ _, _, root = @client.get("/deal_sources/#{id}")
73
+
74
+ DealSource.new(root[:data])
75
+ end
76
+
77
+
78
+ # Update a source
79
+ #
80
+ # put '/deal_sources/{id}'
81
+ #
82
+ # Updates source information
83
+ # If the specified source does not exist, the request will return an error
84
+ # <figure class="notice">
85
+ # If you want to update a source, you **must** make sure source's name is unique
86
+ # </figure>
87
+ #
88
+ # @param deal_source [DealSource, Hash] Either object of the DealSource type or Hash. This object's attributes describe the object to be updated.
89
+ # @return [DealSource] The resulting object represting updated resource.
90
+ def update(deal_source)
91
+ validate_type!(deal_source)
92
+ params = extract_params!(deal_source, :id)
93
+ id = params[:id]
94
+
95
+ attributes = sanitize(deal_source)
96
+ _, _, root = @client.put("/deal_sources/#{id}", attributes)
97
+
98
+ DealSource.new(root[:data])
99
+ end
100
+
101
+
102
+ # Delete a source
103
+ #
104
+ # delete '/deal_sources/{id}'
105
+ #
106
+ # Delete an existing source
107
+ # If the specified source does not exist, the request will return an error
108
+ # This operation cannot be undone
109
+ #
110
+ # @param id [Integer] Unique identifier of a DealSource
111
+ # @return [Boolean] Status of the operation.
112
+ def destroy(id)
113
+ status, _, _ = @client.delete("/deal_sources/#{id}")
114
+ status == 204
115
+ end
116
+
117
+
118
+ private
119
+ def validate_type!(deal_source)
120
+ raise TypeError unless deal_source.is_a?(DealSource) || deal_source.is_a?(Hash)
121
+ end
122
+
123
+ def extract_params!(deal_source, *args)
124
+ params = deal_source.to_h.select{ |k, _| args.include?(k) }
125
+ raise ArgumentError, "one of required attributes is missing. Expected: #{args.join(',')}" if params.count != args.length
126
+ params
127
+ end
128
+
129
+ def sanitize(deal_source)
130
+ deal_source.to_h.select { |k, _| OPTS_KEYS_TO_PERSIST.include?(k) }
131
+ end
132
+ end
133
+ end