easy_hubspot 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -3
- data/Gemfile +1 -1
- data/README.md +47 -10
- data/config/initializers/easy_hubspot.rb +6 -0
- data/easy_hubspot.gemspec +3 -3
- data/lib/easy_hubspot/client.rb +20 -33
- data/lib/easy_hubspot/exceptions.rb +6 -0
- data/lib/easy_hubspot/generators/install_generator.rb +16 -0
- data/lib/easy_hubspot/generators/templates/easy_hubspot.rb +6 -0
- data/lib/easy_hubspot/version.rb +1 -1
- data/lib/easy_hubspot.rb +1 -0
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8afd7c12ba165b752df83f2a711ad3220f0efb7f9fef8a73340ae9dd9c95adeb
|
4
|
+
data.tar.gz: dcd135320a2274849e576f7b2c5497a74323c1713b330f275c6c4f6dfa3cedef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b5da8b90ae02f92056d2af35dea0cbbe8207e84d486345dd89fd7d155b75a13680b735788f2e4b64ba3c9acc617830c8fe29feb3a5b3156c5ceb3cab3b2f724
|
7
|
+
data.tar.gz: c90fb31a0954a82c9bdfbf7c3b0c5df4fde0e4f5c40da12fa09f32afad0f8ca5c7679ae561ca52196b016bebf06bcdeb93edb6d14c57ed354b99b2faf5a75f95
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
|
-
## [
|
1
|
+
## [Official Release]
|
2
|
+
- [0.1.7] - 2023-02-10
|
2
3
|
|
3
|
-
## [
|
4
|
+
## [Unreleased]
|
4
5
|
|
5
|
-
|
6
|
+
## [Initial releases]
|
7
|
+
- [0.1.0] - 2023-02-08
|
8
|
+
- [0.1.1] - 2023-02-09
|
9
|
+
- [0.1.2] - 2023-02-09
|
10
|
+
- [0.1.3] - 2023-02-09
|
11
|
+
- [0.1.4] - 2023-02-09
|
12
|
+
- [0.1.5] - 2023-02-09
|
13
|
+
- [0.1.6] - 2023-02-09
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,24 +1,61 @@
|
|
1
1
|
# EasyHubspot
|
2
|
+
![version](https://img.shields.io/badge/version-0.1.7-green)
|
3
|
+
[![CI](https://github.com/oroth8/easy_hubspot/actions/workflows/ci.yml/badge.svg)](https://github.com/oroth8/easy_hubspot/actions/workflows/ci.yml)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/oroth8/easy_hubspot/badges/gpa.svg)](https://codeclimate.com/github/oroth8/easy_hubspot)
|
2
5
|
|
3
|
-
|
6
|
+
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.
|
4
7
|
|
5
|
-
|
8
|
+
This gem utilizes the `v3` hubspot-api
|
6
9
|
|
7
10
|
## Installation
|
8
11
|
|
9
|
-
|
12
|
+
Add this line to your application's Gemfile:
|
10
13
|
|
11
|
-
|
14
|
+
```ruby
|
15
|
+
gem 'easy_hubspot'
|
16
|
+
```
|
12
17
|
|
13
|
-
|
18
|
+
## Usage
|
14
19
|
|
15
|
-
|
20
|
+
Add the following to your `config/initializers/easy_hubspot.rb` file:
|
16
21
|
|
17
|
-
|
22
|
+
```ruby
|
23
|
+
EasyHubspot.config do |c|
|
24
|
+
c.access_token = 'YOUR API KEY'
|
25
|
+
c.base_url = 'https://api.hubapi.com/'
|
26
|
+
end
|
27
|
+
```
|
18
28
|
|
19
|
-
|
29
|
+
Or run the generator:
|
30
|
+
|
31
|
+
```bash
|
32
|
+
rails g easy_hubspot:install
|
33
|
+
```
|
34
|
+
|
35
|
+
### Contacts
|
36
|
+
|
37
|
+
Please refrence the [hubspot docs](https://developers.hubspot.com/docs/api/crm/contacts)
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
# Create a contact
|
41
|
+
EasyHubspot::Contact.create_contact(properties: { email: '', firstname: '', lastname: '' , etc: ''})
|
42
|
+
|
43
|
+
# Update a contact
|
44
|
+
EasyHubspot::Contact.update_contact(123, properties: { email: '', firstname: '', lastname: '' , etc: ''})
|
45
|
+
|
46
|
+
# Get a contact
|
47
|
+
EasyHubspot::Contact.get_contact(123)
|
48
|
+
# or
|
49
|
+
EasyHubspot::Contact.get_contact('test@gmail.com')
|
50
|
+
|
51
|
+
# Get all contacts
|
52
|
+
EasyHubspot::Contact.get_contacts
|
20
53
|
|
21
|
-
|
54
|
+
# Delete a contact
|
55
|
+
EasyHubspot::Contact.delete_contact(123)
|
56
|
+
# or
|
57
|
+
EasyHubspot::Contact.delete_contact('test@gmail.com')
|
58
|
+
```
|
22
59
|
|
23
60
|
## Development
|
24
61
|
|
@@ -28,7 +65,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
28
65
|
|
29
66
|
## Contributing
|
30
67
|
|
31
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
68
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/oroth8/easy_hubspot.
|
32
69
|
|
33
70
|
## License
|
34
71
|
|
data/easy_hubspot.gemspec
CHANGED
@@ -36,11 +36,11 @@ Gem::Specification.new do |spec|
|
|
36
36
|
|
37
37
|
# development dependencies
|
38
38
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
39
|
-
spec.add_development_dependency 'capybara', '~>
|
39
|
+
spec.add_development_dependency 'capybara', '~> 3.36'
|
40
40
|
spec.add_development_dependency 'generator_spec', '~> 0.9.4'
|
41
|
-
spec.add_development_dependency 'pry', '~> 0.
|
41
|
+
spec.add_development_dependency 'pry', '~> 0.14.2'
|
42
42
|
spec.add_development_dependency 'rake', '~> 13.0'
|
43
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
43
|
+
spec.add_development_dependency 'rspec', '~> 3.12.0'
|
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'
|
data/lib/easy_hubspot/client.rb
CHANGED
@@ -4,44 +4,28 @@ module EasyHubspot
|
|
4
4
|
# EasyHubspot::Client
|
5
5
|
class Client
|
6
6
|
class << self
|
7
|
-
def do_get(path = nil, headers = {}
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
parse_response(response)
|
12
|
-
else
|
13
|
-
HTTParty.get("#{EasyHubspot.configuration.base_url}#{path}", headers: headers)
|
14
|
-
end
|
7
|
+
def do_get(path = nil, headers = {})
|
8
|
+
response = HTTParty.get("#{EasyHubspot.configuration.base_url}#{path}", headers: headers,
|
9
|
+
format: :plain)
|
10
|
+
parse_response(response)
|
15
11
|
end
|
16
12
|
|
17
|
-
def do_post(path = nil, body = {}, headers = {}
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
parse_response(response)
|
22
|
-
else
|
23
|
-
HTTParty.post("#{EasyHubspot.configuration.base_url}#{path}", body: body, headers: headers)
|
24
|
-
end
|
13
|
+
def do_post(path = nil, body = {}, headers = {})
|
14
|
+
response = HTTParty.post("#{EasyHubspot.configuration.base_url}#{path}", body: body, headers: headers,
|
15
|
+
format: :plain)
|
16
|
+
parse_response(response)
|
25
17
|
end
|
26
18
|
|
27
|
-
def do_patch(path = nil, body = {}, headers = {}
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
parse_response(response)
|
32
|
-
else
|
33
|
-
HTTParty.patch("#{EasyHubspot.configuration.base_url}#{path}", body: body, headers: headers)
|
34
|
-
end
|
19
|
+
def do_patch(path = nil, body = {}, headers = {})
|
20
|
+
response = HTTParty.patch("#{EasyHubspot.configuration.base_url}#{path}", body: body, headers: headers,
|
21
|
+
format: :plain)
|
22
|
+
parse_response(response)
|
35
23
|
end
|
36
24
|
|
37
|
-
def do_delete(path = nil, headers = {}
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
parse_response(response)
|
42
|
-
else
|
43
|
-
HTTParty.delete("#{EasyHubspot.configuration.base_url}#{path}", headers: headers)
|
44
|
-
end
|
25
|
+
def do_delete(path = nil, headers = {})
|
26
|
+
response = HTTParty.delete("#{EasyHubspot.configuration.base_url}#{path}", headers: headers,
|
27
|
+
format: :plain)
|
28
|
+
parse_response(response)
|
45
29
|
end
|
46
30
|
|
47
31
|
private
|
@@ -49,7 +33,10 @@ module EasyHubspot
|
|
49
33
|
def parse_response(res)
|
50
34
|
return if res.body.nil?
|
51
35
|
|
52
|
-
JSON.parse res, symbolize_names: true
|
36
|
+
parsed_res = JSON.parse res, symbolize_names: true
|
37
|
+
raise EasyHubspot::HubspotApiError, parsed_res[:message] if parsed_res[:status] == 'error'
|
38
|
+
|
39
|
+
parsed_res
|
53
40
|
end
|
54
41
|
end
|
55
42
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
module EasyHubspot
|
6
|
+
module Generators
|
7
|
+
# InstallGenerator
|
8
|
+
class InstallGenerator < Rails::Generators::Base
|
9
|
+
source_root File.expand_path('templates', __dir__)
|
10
|
+
desc 'This generator creates an initializer file at config/initializers'
|
11
|
+
def copy_initializer
|
12
|
+
copy_file 'easy_hubspot.rb', 'config/initializers/easy_hubspot.rb'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/easy_hubspot/version.rb
CHANGED
data/lib/easy_hubspot.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_hubspot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen Roth
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.36'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.36'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: generator_spec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.14.2
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.14.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 3.
|
103
|
+
version: 3.12.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 3.
|
110
|
+
version: 3.12.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rubocop
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,11 +178,15 @@ files:
|
|
178
178
|
- LICENSE.txt
|
179
179
|
- README.md
|
180
180
|
- Rakefile
|
181
|
+
- config/initializers/easy_hubspot.rb
|
181
182
|
- easy_hubspot.gemspec
|
182
183
|
- lib/easy_hubspot.rb
|
183
184
|
- lib/easy_hubspot/base.rb
|
184
185
|
- lib/easy_hubspot/client.rb
|
185
186
|
- lib/easy_hubspot/contact.rb
|
187
|
+
- lib/easy_hubspot/exceptions.rb
|
188
|
+
- lib/easy_hubspot/generators/install_generator.rb
|
189
|
+
- lib/easy_hubspot/generators/templates/easy_hubspot.rb
|
186
190
|
- lib/easy_hubspot/version.rb
|
187
191
|
- sig/easy_hubspot.rbs
|
188
192
|
homepage: https://github.com/oroth8/easy-hubspot
|