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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71b8b8b0adf023816a69c63eabce11490707324ca7f6dd7ad0a4c675079746c2
4
- data.tar.gz: 415ce8982b292d1c76885629d6c8058fe95334197f233923efac196599c1f584
3
+ metadata.gz: 9ce154fdb34847454b688c962db16c2d70e1ea51f43f532f630552063fd206c6
4
+ data.tar.gz: f8ede8f920e5359db248fb20a4a8e5194fe6f1344a29b720676b03e19f6761b1
5
5
  SHA512:
6
- metadata.gz: 39589dcd934069589f8c345df8d60a54b2c047d000318e7491c90e54d9f7abe1bd15109df5a01ca5616bd110f4ace578cea138dd09fd7d03a74cf8156dafe873
7
- data.tar.gz: 4ec10d8960dc10c34cc44671804ebd8c2db6ced6559b3739d37ebaf4534db640b62c499cab339f113ab3bb55a0def2c17657bd30121fe8f714dec95623dbc3bd
6
+ metadata.gz: 303dbdc024cff0b52bbfd372987cbf83ee7b61d014d0bab2407a47c618e664632c69a2e1031f7a9cfa496ae359b3044b349691c6b4d654a1faa4b97d2c8e39b2
7
+ data.tar.gz: ded9e8f4717f948498b3b2d5b2e7276057edd51ca7f61d897d079802cf2a3fb1584015ff98d0f233e6c0d68e992a5076a987a06e127187aa8a7debd6c8a12ec6
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gemspec
7
7
 
8
8
  group :development, :test do
9
9
  gem 'bundler', '~> 2.2'
10
- gem 'pry', '~> 0.13.1'
10
+ gem 'pry', '~> 0.14.2'
11
11
  gem 'rake', '~> 13.0'
12
12
  gem 'rspec', '~> 3.0'
13
13
  gem 'rubocop', '~> 1.21'
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
- TODO: Delete this and the text below, and describe your gem
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
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
11
+ Add this line to your application's Gemfile:
10
12
 
11
- Install the gem and add to the application's Gemfile by executing:
13
+ ```ruby
14
+ gem 'easy_hubspot'
15
+ ```
12
16
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
17
+ ## Usage
14
18
 
15
- If bundler is not being used to manage dependencies, install the gem by executing:
19
+ Add the following to your `config/initializers/easy_hubspot.rb` file:
16
20
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
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
- ## Usage
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
- TODO: Write usage instructions here
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/[USERNAME]/easy_hubspot.
65
+ Bug reports and pull requests are welcome on GitHub at https://github.com/oroth8/easy_hubspot.
32
66
 
33
67
  ## License
34
68
 
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ EasyHubspot.config do |c|
4
+ c.access_token = 'YOUR API KEY'
5
+ c.base_url = 'https://api.hubapi.com/'
6
+ end
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', '~> 2.7'
40
- spec.add_development_dependency 'pry', '~> 0.13.1'
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.4.0'
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'
@@ -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 = {}, format_plain: true)
8
- if format_plain
9
- response = HTTParty.get("#{EasyHubspot.configuration.base_url}#{path}", headers: headers,
10
- format: :plain)
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 = {}, format_plain: true)
18
- if format_plain
19
- response = HTTParty.post("#{EasyHubspot.configuration.base_url}#{path}", body: body, headers: headers,
20
- format: :plain)
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 = {}, format_plain: true)
28
- if format_plain
29
- response = HTTParty.patch("#{EasyHubspot.configuration.base_url}#{path}", body: body, headers: headers,
30
- format: :plain)
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 = {}, format_plain: true)
38
- if format_plain
39
- response = HTTParty.delete("#{EasyHubspot.configuration.base_url}#{path}", headers: headers,
40
- format: :plain)
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
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ EasyHubspot.config do |c|
4
+ c.access_token = 'YOUR API KEY'
5
+ c.base_url = 'https://api.hubapi.com/'
6
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EasyHubspot
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.7'
5
5
  end
data/lib/easy_hubspot.rb CHANGED
@@ -4,6 +4,7 @@ require 'easy_hubspot/base'
4
4
  require 'easy_hubspot/client'
5
5
  require 'easy_hubspot/contact'
6
6
  require 'easy_hubspot/version'
7
+ require 'easy_hubspot/generators/install_generator'
7
8
 
8
9
  require 'httparty'
9
10
  require 'json'
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.5
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: '2.7'
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: '2.7'
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.13.1
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.13.1
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.4.0
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.4.0
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