rdstation-ruby-client 0.0.5 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +68 -0
- data/lib/rdstation-ruby-client.rb +1 -0
- data/lib/rdstation/contacts.rb +61 -0
- data/lib/rdstation/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d8b49b1c3af26dff4944b5a246306050577424f
|
4
|
+
data.tar.gz: 3e4238d351ee0b2820370d4c7b9ea8285f565fd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14804ae659e189e1ac5f1d3880e8fe7071a1dcbdb035a237e12b06b5f7ee9113d067eb86b28fb63fe47c2dc76cd499e64b7b74bf36d1e0393ff960b892fdee91
|
7
|
+
data.tar.gz: 2fbd0fbe9a184a30b592747d5dcc79b4714c187b993428a69526d1f3a16f0918726ef4abd3fea21fcba23484aef92e23360ed6ab39e19817858751000a76fa1f
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -47,6 +47,74 @@ rdstation_client = RDStation::Client.new('rdstation_token', 'auth_token')
|
|
47
47
|
rdstation_client.change_lead_status(email: 'joe@foo.bar', status: 'won', value: 999)
|
48
48
|
```
|
49
49
|
|
50
|
+
### Contacts
|
51
|
+
|
52
|
+
#### Getting a Contact by UUID
|
53
|
+
|
54
|
+
Returns data about a specific Contact
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
rdstation_contacts = RDStation::Contacts.new('auth_token')
|
58
|
+
rdstation_contacts.get_contact('uuid')
|
59
|
+
```
|
60
|
+
|
61
|
+
More info: https://developers.rdstation.com/pt-BR/reference/contacts#methodGetDetailsuuid
|
62
|
+
|
63
|
+
#### Getting a Contact by Email
|
64
|
+
|
65
|
+
Returns data about a specific Contact
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
rdstation_contacts = RDStation::Contacts.new('auth_token')
|
69
|
+
rdstation_contacts.get_contact_by_email('email')
|
70
|
+
```
|
71
|
+
|
72
|
+
More info: https://developers.rdstation.com/pt-BR/reference/contacts#methodGetDetailsemail
|
73
|
+
|
74
|
+
#### Update a Contact by UUID
|
75
|
+
|
76
|
+
Updates the properties of a Contact.
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
contact_info = {
|
80
|
+
name: "Joe Foo"
|
81
|
+
}
|
82
|
+
|
83
|
+
rdstation_contacts = RDStation::Contacts.new('auth_token')
|
84
|
+
rdstation_contacts.update_contact('uuid', contact_info)
|
85
|
+
```
|
86
|
+
Contact Default Parameters
|
87
|
+
- email
|
88
|
+
- name
|
89
|
+
- job_title
|
90
|
+
- linkedin
|
91
|
+
- facebook
|
92
|
+
- twitter
|
93
|
+
- personal_phone
|
94
|
+
- mobile_phone
|
95
|
+
- website
|
96
|
+
- tags
|
97
|
+
|
98
|
+
More info: https://developers.rdstation.com/pt-BR/reference/contacts#methodPatchDetails
|
99
|
+
|
100
|
+
|
101
|
+
#### Upsert a Contact by identifier and value
|
102
|
+
|
103
|
+
With an UPSERT like behavior, this method is capable of both updating the properties of a Contact or creating a new Contact. Whatever is used as an identifier cannot appear in the request payload as a field. This will result in a [BAD_REQUEST error](https://developers.rdstation.com/pt-BR/error-states#conflicting).
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
contact_info = {
|
107
|
+
name: "Joe Foo"
|
108
|
+
}
|
109
|
+
|
110
|
+
identifier = "email"
|
111
|
+
identifier_value = "joe@foo.bar"
|
112
|
+
|
113
|
+
rdstation_contacts = RDStation::Contacts.new('auth_token')
|
114
|
+
rdstation_contacts.upsert_contact(identifier, identifier_value, contact_info)
|
115
|
+
```
|
116
|
+
|
117
|
+
More info: https://developers.rdstation.com/pt-BR/reference/contacts#methodPatchUpsertDetails
|
50
118
|
|
51
119
|
## Contributing
|
52
120
|
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module RDStation
|
3
|
+
# More info: https://developers.rdstation.com/pt-BR/reference/contacts
|
4
|
+
class Contacts
|
5
|
+
include HTTParty
|
6
|
+
|
7
|
+
def initialize(auth_token)
|
8
|
+
@auth_token = auth_token
|
9
|
+
end
|
10
|
+
|
11
|
+
#
|
12
|
+
# param uuid:
|
13
|
+
# The unique uuid associated to each RD Station Contact.
|
14
|
+
#
|
15
|
+
def get_contact(uuid)
|
16
|
+
self.class.get(base_url(uuid), :headers => required_headers)
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_contact_by_email(email)
|
20
|
+
self.class.get(base_url("email:#{email}"), :headers => required_headers)
|
21
|
+
end
|
22
|
+
|
23
|
+
# The Contact hash may contain the following parameters:
|
24
|
+
# :email
|
25
|
+
# :name
|
26
|
+
# :job_title
|
27
|
+
# :linkedin
|
28
|
+
# :facebook
|
29
|
+
# :twitter
|
30
|
+
# :personal_phone
|
31
|
+
# :mobile_phone
|
32
|
+
# :website
|
33
|
+
# :tags
|
34
|
+
def update_contact(uuid, contact_hash)
|
35
|
+
self.class.patch(base_url(uuid), :body => contact_hash.to_json, :headers => required_headers)
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# param identifier:
|
40
|
+
# Field that will be used to identify the contact.
|
41
|
+
# param identifier_value:
|
42
|
+
# Value to the identifier given.
|
43
|
+
# param contact_hash:
|
44
|
+
# Contact data
|
45
|
+
#
|
46
|
+
def upsert_contact(identifier, identifier_value, contact_hash)
|
47
|
+
path = "#{identifier}:#{identifier_value}"
|
48
|
+
self.class.patch(base_url(path), :body => contact_hash.to_json, :headers => required_headers)
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def base_url(path = "")
|
54
|
+
"https://api.rd.services/platform/contacts/#{path}"
|
55
|
+
end
|
56
|
+
|
57
|
+
def required_headers
|
58
|
+
{ "Authorization" => "Bearer #{@auth_token}", "Content-Type" => "application/json" }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/rdstation/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdstation-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paulo L F Casaretto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- Rakefile
|
124
124
|
- lib/rdstation-ruby-client.rb
|
125
125
|
- lib/rdstation/client.rb
|
126
|
+
- lib/rdstation/contacts.rb
|
126
127
|
- lib/rdstation/version.rb
|
127
128
|
- rdstation-ruby-client.gemspec
|
128
129
|
- spec/lib/rdstation-ruby-client_spec.rb
|
@@ -147,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
148
|
version: '0'
|
148
149
|
requirements: []
|
149
150
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
151
|
+
rubygems_version: 2.6.13
|
151
152
|
signing_key:
|
152
153
|
specification_version: 4
|
153
154
|
summary: Ruby API wrapper for RD Station
|