simple_hubspot 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +8 -3
- data/lib/generators/simple_hubspot/templates/simple_hubspot.rb +1 -1
- data/lib/simple_hubspot/api_client.rb +2 -0
- data/lib/simple_hubspot/contact.rb +5 -0
- data/lib/simple_hubspot/version.rb +1 -1
- metadata +2 -3
- data/generators/simple_hubspot/simple_hubspot_generator.rb +0 -8
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTgzMmRiODNkZGY3MDhmNGIwMTg2NzUxODZjOGY2OTYxMDEzYTEyZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjVhN2U0YzczYjI1OTVjOThjMDExOTYwMmE5NTA5M2EzMzM1ZmEzYw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjIzODFkMmRiNWZmYzk4MmZiY2JkYWMyMWM1MmJhZTkwMjE0NjY3YTc1NGVi
|
10
|
+
ZjBhZDQ1NWYxNjczYWJkMjhlNzEyNTNiOTI0MWI4YjBjMWVmMzgyZWVjYjU5
|
11
|
+
NGZkOTY4MjU5ZDU1Mjc3Y2I0ZTRhYTc3MzdlMDY5MDFiNTAyZTM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzRjZmIyZDJhOWE5MjhiZGE2YTkxODRjN2ZjNWNiNGY3OTk2MzQ0YTE3ZWRi
|
14
|
+
NDQ5NzNjZGEwMGM0Njg5ZGEyMjkxMDQwYTI1NzFlMmQwNTRkYmFkODg3ZGVh
|
15
|
+
MWRlYzA1OTRhN2UxYjBlYTczYWZlNTAzMzc3ZDY4NDIyNjZmMDY=
|
data/README.md
CHANGED
@@ -37,19 +37,24 @@ rails g simple_hubspot:install
|
|
37
37
|
|
38
38
|
```ruby
|
39
39
|
SimpleHubspot.configure do |config|
|
40
|
-
config.hapikey
|
40
|
+
config.hapikey= "YOUR API KEY"
|
41
41
|
end
|
42
42
|
```
|
43
43
|
|
44
44
|
#### Create Or Update Contact
|
45
45
|
|
46
46
|
```ruby
|
47
|
-
SimpleHubspot.create_or_update "email@email.com", { name: "John", age: 14, country: 'BRAZIL' }
|
47
|
+
SimpleHubspot::Contact.create_or_update "email@email.com", { name: "John", age: 14, country: 'BRAZIL' }
|
48
48
|
```
|
49
49
|
|
50
50
|
#### Find by e-mail
|
51
51
|
```ruby
|
52
|
-
SimpleHubspot.find_by_email "email@email.com"
|
52
|
+
SimpleHubspot::Contact.find_by_email "email@email.com"
|
53
|
+
```
|
54
|
+
|
55
|
+
#### Update Contact
|
56
|
+
```ruby
|
57
|
+
SimpleHubspot::Contact.update 1234, { email: "email@email.com" }
|
53
58
|
```
|
54
59
|
|
55
60
|
## Development
|
@@ -23,11 +23,13 @@ module SimpleHubspot
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def response_fail(response = {})
|
26
|
+
return { success: false } if response.empty?
|
26
27
|
json = JSON.parse(response, symbolize_names: true)
|
27
28
|
json.merge(success: false)
|
28
29
|
end
|
29
30
|
|
30
31
|
def response_success(response = {})
|
32
|
+
return { success: true } if response.empty?
|
31
33
|
json = JSON.parse(response, symbolize_names: true)
|
32
34
|
json.merge(success: true)
|
33
35
|
end
|
@@ -10,6 +10,11 @@ module SimpleHubspot
|
|
10
10
|
def find_by_email(email)
|
11
11
|
ApiClient.do_get "/contacts/v1/contact/email/#{email}/profile"
|
12
12
|
end
|
13
|
+
|
14
|
+
def update(vid, params = {})
|
15
|
+
raise ArgumentError unless vid
|
16
|
+
ApiClient.do_post "/contacts/v1/contact/vid/#{vid}/profile", { properties: Utils.hash_to_properties(params) }
|
17
|
+
end
|
13
18
|
end
|
14
19
|
|
15
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_hubspot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Breno Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,7 +70,6 @@ files:
|
|
70
70
|
- Rakefile
|
71
71
|
- bin/console
|
72
72
|
- bin/setup
|
73
|
-
- generators/simple_hubspot/simple_hubspot_generator.rb
|
74
73
|
- lib/generators/simple_hubspot/install_generator.rb
|
75
74
|
- lib/generators/simple_hubspot/templates/simple_hubspot.rb
|
76
75
|
- lib/simple_hubspot.rb
|
@@ -1,8 +0,0 @@
|
|
1
|
-
class SimpleHubspotGenerator < Rails::Generator::Base
|
2
|
-
desc "This generator creates an initializer file at config/initializers"
|
3
|
-
source_root File.expand_path('../templates', __FILE__)
|
4
|
-
namespace 'simple_hubspot'
|
5
|
-
def copy_initializer_file
|
6
|
-
copy_file "simple_hubspot.rb", "config/initializers/#{file_name}.rb"
|
7
|
-
end
|
8
|
-
end
|