rdstation-ruby-client 0.0.5 → 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b7a4c99778510e108208f90b32ae15a9e0d17fd
4
- data.tar.gz: 82e639874139f4f0989f4c2dffdd4d82fe14c62d
3
+ metadata.gz: 8d8b49b1c3af26dff4944b5a246306050577424f
4
+ data.tar.gz: 3e4238d351ee0b2820370d4c7b9ea8285f565fd6
5
5
  SHA512:
6
- metadata.gz: 1d3dc24bdddd186f3933c3c65cb32f00ff3d48bfc3c67a0dc5bc130064787e85d194c40609d8b23688e61a8783bfb8aad67fe69cebf34809b4d1e1e3ae106f00
7
- data.tar.gz: b601e929310add3f122dd92c66919f82614ba3973d33004bf5e03565b7814458d59003261c4e31ed7e3c45a4fa9912573bf50a85a3777b944e8bce59d9dda173
6
+ metadata.gz: 14804ae659e189e1ac5f1d3880e8fe7071a1dcbdb035a237e12b06b5f7ee9113d067eb86b28fb63fe47c2dc76cd499e64b7b74bf36d1e0393ff960b892fdee91
7
+ data.tar.gz: 2fbd0fbe9a184a30b592747d5dcc79b4714c187b993428a69526d1f3a16f0918726ef4abd3fea21fcba23484aef92e23360ed6ab39e19817858751000a76fa1f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rdstation-ruby-client (0.0.4)
4
+ rdstation-ruby-client (0.0.5)
5
5
  httparty (~> 0.12)
6
6
 
7
7
  GEM
@@ -53,4 +53,4 @@ DEPENDENCIES
53
53
  webmock
54
54
 
55
55
  BUNDLED WITH
56
- 1.10.3
56
+ 1.13.2
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
 
@@ -1,2 +1,3 @@
1
1
  require "httparty"
2
2
  require "rdstation/client"
3
+ require "rdstation/contacts"
@@ -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
@@ -1,3 +1,3 @@
1
1
  module RDStation
2
- VERSION = "0.0.5"
2
+ VERSION = '0.1'.freeze
3
3
  end
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.0.5
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: 2016-10-14 00:00:00.000000000 Z
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.4.8
151
+ rubygems_version: 2.6.13
151
152
  signing_key:
152
153
  specification_version: 4
153
154
  summary: Ruby API wrapper for RD Station