easy_hubspot 0.1.5 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +45 -11
- data/config/initializers/easy_hubspot.rb +6 -0
- data/easy_hubspot.gemspec +4 -3
- data/lib/easy_hubspot/client.rb +16 -32
- 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 +24 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ce154fdb34847454b688c962db16c2d70e1ea51f43f532f630552063fd206c6
|
4
|
+
data.tar.gz: f8ede8f920e5359db248fb20a4a8e5194fe6f1344a29b720676b03e19f6761b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 303dbdc024cff0b52bbfd372987cbf83ee7b61d014d0bab2407a47c618e664632c69a2e1031f7a9cfa496ae359b3044b349691c6b4d654a1faa4b97d2c8e39b2
|
7
|
+
data.tar.gz: ded9e8f4717f948498b3b2d5b2e7276057edd51ca7f61d897d079802cf2a3fb1584015ff98d0f233e6c0d68e992a5076a987a06e127187aa8a7debd6c8a12ec6
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,24 +1,58 @@
|
|
1
1
|
# EasyHubspot
|
2
|
+
![version](https://img.shields.io/badge/version-0.1.6-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
|
-
|
4
|
-
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/easy_hubspot`. To experiment with that code, run `bin/console` for an interactive prompt.
|
6
|
+
Work in progress: This gem is not ready for production use.
|
6
7
|
|
8
|
+
This is a lightweight wrapper for the Hubspot API. It is designed to be easy to use and to provide a simple interface for the most common use cases.
|
7
9
|
## Installation
|
8
10
|
|
9
|
-
|
11
|
+
Add this line to your application's Gemfile:
|
10
12
|
|
11
|
-
|
13
|
+
```ruby
|
14
|
+
gem 'easy_hubspot'
|
15
|
+
```
|
12
16
|
|
13
|
-
|
17
|
+
## Usage
|
14
18
|
|
15
|
-
|
19
|
+
Add the following to your `config/initializers/easy_hubspot.rb` file:
|
16
20
|
|
17
|
-
|
21
|
+
```ruby
|
22
|
+
EasyHubspot.config do |c|
|
23
|
+
c.access_token = 'YOUR API KEY'
|
24
|
+
c.base_url = 'https://api.hubapi.com/'
|
25
|
+
end
|
26
|
+
```
|
18
27
|
|
19
|
-
|
28
|
+
Or run the generator:
|
29
|
+
|
30
|
+
```bash
|
31
|
+
rails g easy_hubspot:install
|
32
|
+
```
|
33
|
+
|
34
|
+
### Contacts
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
# Create a contact
|
38
|
+
EasyHubspot::Contact.create_contact(properties: { email: '', firstname: '', lastname: '' , etc: ''})
|
39
|
+
|
40
|
+
# Update a contact
|
41
|
+
EasyHubspot::Contact.update_contact(123, properties: { email: '', firstname: '', lastname: '' , etc: ''})
|
42
|
+
|
43
|
+
# Get a contact
|
44
|
+
EasyHubspot::Contact.get_contact(123)
|
45
|
+
# or
|
46
|
+
EasyHubspot::Contact.get_contact('test@gmail.com')
|
47
|
+
|
48
|
+
# Get all contacts
|
49
|
+
EasyHubspot::Contact.get_contacts
|
20
50
|
|
21
|
-
|
51
|
+
# Delete a contact
|
52
|
+
EasyHubspot::Contact.delete_contact(123)
|
53
|
+
# or
|
54
|
+
EasyHubspot::Contact.delete_contact('test@gmail.com')
|
55
|
+
```
|
22
56
|
|
23
57
|
## Development
|
24
58
|
|
@@ -28,7 +62,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
28
62
|
|
29
63
|
## Contributing
|
30
64
|
|
31
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
65
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/oroth8/easy_hubspot.
|
32
66
|
|
33
67
|
## License
|
34
68
|
|
data/easy_hubspot.gemspec
CHANGED
@@ -36,10 +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', '~>
|
40
|
-
spec.add_development_dependency '
|
39
|
+
spec.add_development_dependency 'capybara', '~> 3.36'
|
40
|
+
spec.add_development_dependency 'generator_spec', '~> 0.9.4'
|
41
|
+
spec.add_development_dependency 'pry', '~> 0.14.2'
|
41
42
|
spec.add_development_dependency 'rake', '~> 13.0'
|
42
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
43
|
+
spec.add_development_dependency 'rspec', '~> 3.12.0'
|
43
44
|
spec.add_development_dependency 'rubocop', '~> 1.2'
|
44
45
|
spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
45
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
|
@@ -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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen Roth
|
@@ -44,28 +44,42 @@ 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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: generator_spec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.4
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.9.4
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: pry
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
75
|
+
version: 0.14.2
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
82
|
+
version: 0.14.2
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +100,14 @@ dependencies:
|
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: 3.
|
103
|
+
version: 3.12.0
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 3.
|
110
|
+
version: 3.12.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rubocop
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,11 +178,14 @@ files:
|
|
164
178
|
- LICENSE.txt
|
165
179
|
- README.md
|
166
180
|
- Rakefile
|
181
|
+
- config/initializers/easy_hubspot.rb
|
167
182
|
- easy_hubspot.gemspec
|
168
183
|
- lib/easy_hubspot.rb
|
169
184
|
- lib/easy_hubspot/base.rb
|
170
185
|
- lib/easy_hubspot/client.rb
|
171
186
|
- lib/easy_hubspot/contact.rb
|
187
|
+
- lib/easy_hubspot/generators/install_generator.rb
|
188
|
+
- lib/easy_hubspot/generators/templates/easy_hubspot.rb
|
172
189
|
- lib/easy_hubspot/version.rb
|
173
190
|
- sig/easy_hubspot.rbs
|
174
191
|
homepage: https://github.com/oroth8/easy-hubspot
|