easy_hubspot 1.0.0 → 1.0.1
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 +4 -4
- data/README.md +65 -0
- data/lib/easy_hubspot/contact.rb +2 -2
- data/lib/easy_hubspot/deal.rb +2 -2
- data/lib/easy_hubspot/line_item.rb +36 -0
- data/lib/easy_hubspot/product.rb +36 -0
- data/lib/easy_hubspot/version.rb +1 -1
- data/lib/easy_hubspot.rb +2 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a254fb0299eefa9a9c9227d8ba6272c6cdf6822c42be93dfb4f84a687ccd4373
|
4
|
+
data.tar.gz: 52e06e382d6077e8381852af7948cb92ddb72826b9491a94711ca40896561147
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/easy_hubspot/contact.rb
CHANGED
@@ -35,13 +35,13 @@ module EasyHubspot
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
|
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
|
-
|
45
|
+
end
|
46
46
|
end
|
47
47
|
end
|
data/lib/easy_hubspot/deal.rb
CHANGED
@@ -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
|
data/lib/easy_hubspot/version.rb
CHANGED
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.
|
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
|
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.
|
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
|