easy_hubspot 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d4c8f01d51cfd846f1687d8f2ee3f51a0dba0ad695adfc29fe676366ad4bc02
4
- data.tar.gz: c0958ecdbc0702449e1f6955a2167984586e92c885631fa63a53df4739c180a0
3
+ metadata.gz: a254fb0299eefa9a9c9227d8ba6272c6cdf6822c42be93dfb4f84a687ccd4373
4
+ data.tar.gz: 52e06e382d6077e8381852af7948cb92ddb72826b9491a94711ca40896561147
5
5
  SHA512:
6
- metadata.gz: 4d5c584b66c728f4216e2e3a77f272623f5d92b1fffb0cd7aa6e2ebccd11ceee2761c255b7b370578f24cfd25a1c2e8a694a71f47cfa36cd18a745326897d7e8
7
- data.tar.gz: b8813814c8559cc0675ca2b978ee3fdb613e17565d31f1572d4198b19bfc71a7d5d5420e423d81c1478ccaf12b65f0be9a08660b51ca9f59c5ea9a76503ea4be
6
+ metadata.gz: 6cdb84c2367ed3f15bace53f615d0a3faa8dab988a9ab82afccfa7ba693dd10493bc91b0b93f19550f68f25150309473bcd3988190dd8a812e2c78996b5e670c
7
+ data.tar.gz: ad9857a34205ae826e9c32bda6f54f40db989d0b37f7705c843aba3cdb32ab493aadf8abb0877a8fb6b0e4231b47e784d2e64f37e43a82debfa394c61bd74ae2
data/README.md CHANGED
@@ -12,6 +12,8 @@ This gem utilizes the `v3` hubspot-api
12
12
  ## CRM Objects
13
13
  - [Contacts](#contacts)
14
14
  - [Deals](#deals)
15
+ - [Products](#products)
16
+ - [Line Items](#line-items)
15
17
 
16
18
  - [Error Handling](#error-handling)
17
19
 
@@ -138,6 +140,69 @@ Please refrence the [hubspot docs](https://developers.hubspot.com/docs/api/crm/c
138
140
  EasyHubspot::Deal.delete_deal(123)
139
141
  ```
140
142
 
143
+ ### Products
144
+ Please refrence the [hubspot docs](https://developers.hubspot.com/docs/api/crm/products)
145
+ ```ruby
146
+ # Create a product
147
+ # required: body
148
+ # returns: parsed hubspot product
149
+ EasyHubspot::Product.create_product(properties: { name: '', price: '', etc: ''})
150
+
151
+ # Update a product
152
+ # required: product_id, body
153
+ # - product_id: must be a hubspot product_id
154
+ # returns: parsed hubspot product
155
+ EasyHubspot::Product.update_product(123, properties: { name: '', price: '', etc: ''})
156
+
157
+ # Get a product
158
+ # required: product_id
159
+ # - product_id: must be a hubspot product_id
160
+ # returns: parsed hubspot product
161
+ EasyHubspot::Product.get_product(123)
162
+
163
+ # Get all products
164
+ # returns: parsed hubspot products
165
+ EasyHubspot::Product.get_products
166
+
167
+ # Delete a product
168
+ # required: product_id
169
+ # - product_id: must be a hubspot product_id
170
+ # returns: {status: 'success'}
171
+ EasyHubspot::Product.delete_product(123)
172
+ ```
173
+
174
+ ### Line Items
175
+ Please refrence the [hubspot docs](https://developers.hubspot.com/docs/api/crm/line-items)
176
+ ```ruby
177
+ # Create a line item
178
+ # required: body
179
+ # Use hs_product_id property to base on an existing product
180
+ # returns: parsed hubspot line item
181
+ EasyHubspot::LineItem.create_line_item(properties: { quantity: '', hs_product_id: '', etc: ''})
182
+
183
+ # Update a line item
184
+ # required: line_item_id, body
185
+ # - line_item_id: must be a hubspot line_item_id
186
+ # returns: parsed hubspot line item
187
+ EasyHubspot::LineItem.update_line_item(123, properties: { quantity: '', etc: ''})
188
+
189
+ # Get a line item
190
+ # required: line_item_id
191
+ # - line_item_id: must be a hubspot line_item_id
192
+ # returns: parsed hubspot line item
193
+ EasyHubspot::LineItem.get_line_item(123)
194
+
195
+ # Get all line items
196
+ # returns: parsed hubspot line items
197
+ EasyHubspot::LineItem.get_line_items
198
+
199
+ # Delete a line item
200
+ # required: line_item_id
201
+ # - line_item_id: must be a hubspot line_item_id
202
+ # returns: {status: 'success'}
203
+ EasyHubspot::LineItem.delete_line_item(123)
204
+ ```
205
+
141
206
  ## Error Handling
142
207
 
143
208
  ```ruby
@@ -35,13 +35,13 @@ module EasyHubspot
35
35
  end
36
36
  end
37
37
 
38
- private
38
+ private
39
39
 
40
40
  def determine_endpoint(value)
41
41
  email_endpoint = "#{CONTACT_ENDPOINT}/#{value}?idProperty=email"
42
42
  id_endpoint = "#{CONTACT_ENDPOINT}/#{value}"
43
43
  email?(value.to_s) ? email_endpoint : id_endpoint
44
44
  end
45
- end
45
+ end
46
46
  end
47
47
  end
@@ -26,11 +26,11 @@ module EasyHubspot
26
26
  Client.do_delete(deal_id_endpoint(deal_id), headers)
27
27
  end
28
28
 
29
- private
29
+ private
30
30
 
31
31
  def deal_id_endpoint(deal_id)
32
32
  "#{DEAL_ENDPOINT}/#{deal_id}"
33
33
  end
34
- end
34
+ end
35
35
  end
36
36
  end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EasyHubspot
4
+ # class EasyHubspot::LineItem
5
+ class LineItem < EasyHubspot::Base
6
+ class << self
7
+ LINE_ITEM_ENDPOINT = 'crm/v3/objects/line_items'
8
+
9
+ def get_line_item(line_item_id)
10
+ Client.do_get(line_item_id_endpoint(line_item_id), headers)
11
+ end
12
+
13
+ def get_line_items
14
+ Client.do_get(LINE_ITEM_ENDPOINT, headers)
15
+ end
16
+
17
+ def create_line_item(body)
18
+ Client.do_post(LINE_ITEM_ENDPOINT, body, headers)
19
+ end
20
+
21
+ def update_line_item(line_item_id, body)
22
+ Client.do_patch(line_item_id_endpoint(line_item_id), body, headers)
23
+ end
24
+
25
+ def delete_line_item(line_item_id)
26
+ Client.do_delete(line_item_id_endpoint(line_item_id), headers)
27
+ end
28
+
29
+ private
30
+
31
+ def line_item_id_endpoint(line_item_id)
32
+ "#{LINE_ITEM_ENDPOINT}/#{line_item_id}"
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EasyHubspot
4
+ # class EasyHubspot::Product
5
+ class Product < EasyHubspot::Base
6
+ class << self
7
+ PRODUCT_ENDPOINT = 'crm/v3/objects/products'
8
+
9
+ def get_product(product_id)
10
+ Client.do_get(product_id_endpoint(product_id), headers)
11
+ end
12
+
13
+ def get_products
14
+ Client.do_get(PRODUCT_ENDPOINT, headers)
15
+ end
16
+
17
+ def create_product(body)
18
+ Client.do_post(PRODUCT_ENDPOINT, body, headers)
19
+ end
20
+
21
+ def update_product(product_id, body)
22
+ Client.do_patch(product_id_endpoint(product_id), body, headers)
23
+ end
24
+
25
+ def delete_product(product_id)
26
+ Client.do_delete(product_id_endpoint(product_id), headers)
27
+ end
28
+
29
+ private
30
+
31
+ def product_id_endpoint(product_id)
32
+ "#{PRODUCT_ENDPOINT}/#{product_id}"
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EasyHubspot
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
data/lib/easy_hubspot.rb CHANGED
@@ -4,6 +4,8 @@ require 'easy_hubspot/base'
4
4
  require 'easy_hubspot/client'
5
5
  require 'easy_hubspot/contact'
6
6
  require 'easy_hubspot/deal'
7
+ require 'easy_hubspot/product'
8
+ require 'easy_hubspot/line_item'
7
9
  require 'easy_hubspot/version'
8
10
  require 'easy_hubspot/generators/install_generator'
9
11
  require 'easy_hubspot/exceptions'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_hubspot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owen Roth
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-22 00:00:00.000000000 Z
11
+ date: 2023-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -202,6 +202,8 @@ files:
202
202
  - lib/easy_hubspot/exceptions.rb
203
203
  - lib/easy_hubspot/generators/install_generator.rb
204
204
  - lib/easy_hubspot/generators/templates/easy_hubspot.rb
205
+ - lib/easy_hubspot/line_item.rb
206
+ - lib/easy_hubspot/product.rb
205
207
  - lib/easy_hubspot/version.rb
206
208
  - sig/easy_hubspot.rbs
207
209
  homepage: https://github.com/oroth8/easy-hubspot
@@ -226,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
228
  - !ruby/object:Gem::Version
227
229
  version: '0'
228
230
  requirements: []
229
- rubygems_version: 3.3.26
231
+ rubygems_version: 3.4.10
230
232
  signing_key:
231
233
  specification_version: 4
232
234
  summary: An easier way to integrate with the Hubspot API