easy_hubspot 0.1.10 → 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/CHANGELOG.md +6 -5
- data/Gemfile +4 -0
- data/README.md +68 -2
- data/easy_hubspot.gemspec +1 -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 +19 -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/CHANGELOG.md
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
## [Official Release]
|
2
|
-
- [0.
|
3
|
-
- [0.1.8] - 2023-02-10
|
4
|
-
- [0.1.9] - 2023-02-14 https://github.com/oroth8/easy_hubspot/pull/6
|
5
|
-
- [0.1.10] - 2023-02-14 https://github.com/oroth8/easy_hubspot/pull/7
|
2
|
+
- [1.0.0] - 2023-02-22 https://github.com/oroth8/easy_hubspot/pull/10
|
6
3
|
|
7
4
|
## [Unreleased]
|
8
5
|
|
9
|
-
## [Initial releases]
|
6
|
+
## [Initial releases (Beta)]
|
10
7
|
- [0.1.0] - 2023-02-08
|
11
8
|
- [0.1.1] - 2023-02-09
|
12
9
|
- [0.1.2] - 2023-02-09
|
@@ -14,3 +11,7 @@
|
|
14
11
|
- [0.1.4] - 2023-02-09
|
15
12
|
- [0.1.5] - 2023-02-09
|
16
13
|
- [0.1.6] - 2023-02-09
|
14
|
+
- [0.1.7] - 2023-02-10
|
15
|
+
- [0.1.8] - 2023-02-10
|
16
|
+
- [0.1.9] - 2023-02-14 https://github.com/oroth8/easy_hubspot/pull/6
|
17
|
+
- [0.1.10] - 2023-02-14 https://github.com/oroth8/easy_hubspot/pull/7
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# EasyHubspot
|
2
|
-
Stable: 
|
3
|
+
Latest: 
|
4
4
|
[](https://github.com/oroth8/easy_hubspot/actions/workflows/ci.yml)
|
5
5
|
[](https://codeclimate.com/github/oroth8/easy_hubspot)
|
6
|
+
[](https://codeclimate.com/github/oroth8/easy_hubspot/test_coverage)
|
6
7
|
|
7
8
|
This is a lightweight wrapper for the Hubspot API. It is designed to be easy to use and to provide a simple setup for the most common use cases.
|
8
9
|
|
@@ -11,6 +12,8 @@ This gem utilizes the `v3` hubspot-api
|
|
11
12
|
## CRM Objects
|
12
13
|
- [Contacts](#contacts)
|
13
14
|
- [Deals](#deals)
|
15
|
+
- [Products](#products)
|
16
|
+
- [Line Items](#line-items)
|
14
17
|
|
15
18
|
- [Error Handling](#error-handling)
|
16
19
|
|
@@ -137,6 +140,69 @@ Please refrence the [hubspot docs](https://developers.hubspot.com/docs/api/crm/c
|
|
137
140
|
EasyHubspot::Deal.delete_deal(123)
|
138
141
|
```
|
139
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
|
+
|
140
206
|
## Error Handling
|
141
207
|
|
142
208
|
```ruby
|
data/easy_hubspot.gemspec
CHANGED
@@ -44,5 +44,6 @@ Gem::Specification.new do |spec|
|
|
44
44
|
spec.add_development_dependency 'rubocop', '~> 1.2'
|
45
45
|
spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
46
46
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.18.1'
|
47
|
+
spec.add_development_dependency 'simplecov', '~> 0.17.0'
|
47
48
|
spec.add_development_dependency 'webmock', '~> 3.14'
|
48
49
|
end
|
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: 0.1
|
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
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 2.18.1
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: simplecov
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 0.17.0
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 0.17.0
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: webmock
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,6 +202,8 @@ files:
|
|
188
202
|
- lib/easy_hubspot/exceptions.rb
|
189
203
|
- lib/easy_hubspot/generators/install_generator.rb
|
190
204
|
- lib/easy_hubspot/generators/templates/easy_hubspot.rb
|
205
|
+
- lib/easy_hubspot/line_item.rb
|
206
|
+
- lib/easy_hubspot/product.rb
|
191
207
|
- lib/easy_hubspot/version.rb
|
192
208
|
- sig/easy_hubspot.rbs
|
193
209
|
homepage: https://github.com/oroth8/easy-hubspot
|
@@ -212,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
228
|
- !ruby/object:Gem::Version
|
213
229
|
version: '0'
|
214
230
|
requirements: []
|
215
|
-
rubygems_version: 3.
|
231
|
+
rubygems_version: 3.4.10
|
216
232
|
signing_key:
|
217
233
|
specification_version: 4
|
218
234
|
summary: An easier way to integrate with the Hubspot API
|