easy_hubspot 0.1.6 → 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: 15bcc6ca4b7e8b160927aad5170f22efd765358612e65c91b21d80071d5c6d6d
4
- data.tar.gz: 9be1296e8f614c6ef77bfe25d14aad9ffaaa714ccf18f4cb549ed49ecf467737
3
+ metadata.gz: 9ce154fdb34847454b688c962db16c2d70e1ea51f43f532f630552063fd206c6
4
+ data.tar.gz: f8ede8f920e5359db248fb20a4a8e5194fe6f1344a29b720676b03e19f6761b1
5
5
  SHA512:
6
- metadata.gz: cc9087d34a7f1d10728fe8eb3c5aeca654655cda1a8cc938eb804c21c40f0fa3b8073988cb2776bc538d3d4ce86dfea49e594198ea602487aeefaaa5a453e183
7
- data.tar.gz: 9274936c9c512e5627702a5aaa63e7253c3ce6e1c72ec858d722a3376d412c3abbcf96c916437322c0f779e0c0d717ff169098663db396c34c3bd390feed237f
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,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', '~> 2.7'
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.13.1'
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.4.0'
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'
@@ -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.6'
4
+ VERSION = '0.1.7'
5
5
  end
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.6
4
+ version: 0.1.7
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: '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
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.13.1
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.13.1
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.4.0
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.4.0
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,14 @@ 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/generators/install_generator.rb
188
+ - lib/easy_hubspot/generators/templates/easy_hubspot.rb
186
189
  - lib/easy_hubspot/version.rb
187
190
  - sig/easy_hubspot.rbs
188
191
  homepage: https://github.com/oroth8/easy-hubspot