easy_hubspot 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +31 -0
- data/easy_hubspot.gemspec +3 -3
- data/lib/easy_hubspot/base.rb +2 -6
- data/lib/easy_hubspot/contact.rb +10 -17
- data/lib/easy_hubspot/version.rb +1 -1
- data/lib/easy_hubspot.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71b8b8b0adf023816a69c63eabce11490707324ca7f6dd7ad0a4c675079746c2
|
4
|
+
data.tar.gz: 415ce8982b292d1c76885629d6c8058fe95334197f233923efac196599c1f584
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39589dcd934069589f8c345df8d60a54b2c047d000318e7491c90e54d9f7abe1bd15109df5a01ca5616bd110f4ace578cea138dd09fd7d03a74cf8156dafe873
|
7
|
+
data.tar.gz: 4ec10d8960dc10c34cc44671804ebd8c2db6ced6559b3739d37ebaf4534db640b62c499cab339f113ab3bb55a0def2c17657bd30121fe8f714dec95623dbc3bd
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
- rubocop-rake
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 2.6.0
|
7
|
+
|
8
|
+
Style/HashSyntax:
|
9
|
+
Exclude:
|
10
|
+
- 'lib/easy_hubspot/client.rb'
|
11
|
+
|
12
|
+
Naming/AccessorMethodName:
|
13
|
+
Enabled: false
|
14
|
+
Include:
|
15
|
+
- 'lib/easy_hubspot/client.rb'
|
16
|
+
|
17
|
+
Layout/LineLength:
|
18
|
+
Max: 125
|
19
|
+
|
20
|
+
RSpec/BeforeAfterAll:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
RSpec/ContextWording:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
RSpec/MultipleExpectations:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Style/StringLiterals:
|
30
|
+
Exclude:
|
31
|
+
- 'lib/easy_hubspot/base.rb'
|
data/easy_hubspot.gemspec
CHANGED
@@ -16,9 +16,9 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
21
|
+
spec.metadata['changelog_uri'] = 'https://github.com/oroth8/easy-hubspot/blob/main/CHANGELOG.md'
|
22
22
|
|
23
23
|
# Specify which files should be added to the gem when it is released.
|
24
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/lib/easy_hubspot/base.rb
CHANGED
@@ -5,17 +5,13 @@ module EasyHubspot
|
|
5
5
|
class Base
|
6
6
|
class << self
|
7
7
|
def headers
|
8
|
-
{ "Content-Type"
|
9
|
-
"Authorization"
|
8
|
+
{ "Content-Type" => 'application/json',
|
9
|
+
"Authorization" => "Bearer #{EasyHubspot.configuration.access_token}" }
|
10
10
|
end
|
11
11
|
|
12
12
|
def email?(string)
|
13
13
|
URI::MailTo::EMAIL_REGEXP.match?(string)
|
14
14
|
end
|
15
|
-
|
16
|
-
def merge_path(path)
|
17
|
-
EasyHubspot.configuration.base_url + path
|
18
|
-
end
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
data/lib/easy_hubspot/contact.rb
CHANGED
@@ -7,40 +7,33 @@ module EasyHubspot
|
|
7
7
|
CONTACT_ENDPOINT = 'crm/v3/objects/contacts'
|
8
8
|
|
9
9
|
def get_contact(contact_id)
|
10
|
-
|
11
|
-
Client.do_get(path, headers)
|
10
|
+
Client.do_get(determine_endpoint(contact_id), headers)
|
12
11
|
end
|
13
12
|
|
14
13
|
def get_contacts
|
15
|
-
Client.do_get(
|
14
|
+
Client.do_get(CONTACT_ENDPOINT, headers)
|
16
15
|
end
|
17
16
|
|
18
17
|
def create_contact(body)
|
19
|
-
Client.do_post(
|
18
|
+
Client.do_post(CONTACT_ENDPOINT, body, headers)
|
20
19
|
end
|
21
20
|
|
22
21
|
def update_contact(contact_id, body)
|
23
|
-
|
24
|
-
Client.do_patch(path, body, headers)
|
22
|
+
Client.do_patch(determine_endpoint(contact_id), body, headers)
|
25
23
|
end
|
26
24
|
|
27
25
|
def delete_contact(contact_id)
|
28
|
-
|
29
|
-
Client.do_delete(path, headers)
|
26
|
+
Client.do_delete(determine_endpoint(contact_id), headers)
|
30
27
|
end
|
31
28
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
# def get_associated_contacts(contact_id, object_type, object_id, association_id)
|
30
|
+
# # TODO: Error handling arguments
|
31
|
+
# path = merge_path("#{CONTACT_ENDPOINT}/#{contact_id}/associations/#{object_type}/#{object_id}/#{association_id}")
|
32
|
+
# Client.do_get(path, headers)
|
33
|
+
# end
|
37
34
|
|
38
35
|
private
|
39
36
|
|
40
|
-
def contact_path
|
41
|
-
merge_path(CONTACT_ENDPOINT)
|
42
|
-
end
|
43
|
-
|
44
37
|
def determine_endpoint(value)
|
45
38
|
email_endpoint = "#{CONTACT_ENDPOINT}/#{value}?idProperty=email"
|
46
39
|
id_endpoint = "#{CONTACT_ENDPOINT}/#{value}"
|
data/lib/easy_hubspot/version.rb
CHANGED
data/lib/easy_hubspot.rb
CHANGED
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: 0.1.5
|
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-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -158,6 +158,7 @@ executables: []
|
|
158
158
|
extensions: []
|
159
159
|
extra_rdoc_files: []
|
160
160
|
files:
|
161
|
+
- ".rubocop.yml"
|
161
162
|
- CHANGELOG.md
|
162
163
|
- Gemfile
|
163
164
|
- LICENSE.txt
|
@@ -173,7 +174,10 @@ files:
|
|
173
174
|
homepage: https://github.com/oroth8/easy-hubspot
|
174
175
|
licenses:
|
175
176
|
- MIT
|
176
|
-
metadata:
|
177
|
+
metadata:
|
178
|
+
homepage_uri: https://github.com/oroth8/easy-hubspot
|
179
|
+
source_code_uri: https://github.com/oroth8/easy-hubspot
|
180
|
+
changelog_uri: https://github.com/oroth8/easy-hubspot/blob/main/CHANGELOG.md
|
177
181
|
post_install_message:
|
178
182
|
rdoc_options: []
|
179
183
|
require_paths:
|