dolmade 0.1.0 → 0.1.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.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/dolmade.gemspec +1 -1
- data/lib/dolmade.rb +14 -3
- data/spec/dolmade_spec.rb +7 -0
- metadata +3 -3
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/dolmade.gemspec
CHANGED
data/lib/dolmade.rb
CHANGED
@@ -6,7 +6,8 @@ module Dolmade
|
|
6
6
|
|
7
7
|
include HTTParty
|
8
8
|
format :json
|
9
|
-
base_uri "https://personalize.rapleaf.com/v4
|
9
|
+
base_uri "https://personalize.rapleaf.com/v4"
|
10
|
+
# debug_output $stderr
|
10
11
|
|
11
12
|
attr_accessor :api_key
|
12
13
|
|
@@ -15,14 +16,24 @@ module Dolmade
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def lookup_by_email(email)
|
18
|
-
|
19
|
+
if email.respond_to?(:map)
|
20
|
+
result = bulk_lookup_by_email(email)
|
21
|
+
result.map! { |e| Person.new(e) }
|
22
|
+
else
|
23
|
+
Person.new(self.request({:email => email}))
|
24
|
+
end
|
19
25
|
end
|
20
26
|
|
21
27
|
protected
|
22
28
|
|
23
29
|
def request(query={})
|
24
30
|
query.merge!({:api_key => self.api_key})
|
25
|
-
self.class.get('',{:query => query})
|
31
|
+
self.class.get('/dr',{:query => query})
|
32
|
+
end
|
33
|
+
|
34
|
+
def bulk_lookup_by_email(emails)
|
35
|
+
emails.map! { |e| {'email' => e} }
|
36
|
+
self.class.post('/bulk', {:query => {:api_key => self.api_key}, :body => emails.to_json, :headers => {'Content-Type' => 'application/json'}})
|
26
37
|
end
|
27
38
|
|
28
39
|
end
|
data/spec/dolmade_spec.rb
CHANGED
@@ -10,4 +10,11 @@ describe "Dolmade" do
|
|
10
10
|
@dolmade.lookup_by_email('jordan@fiftyfootfoghorn.com').class.should eq(Dolmade::Person)
|
11
11
|
end
|
12
12
|
|
13
|
+
it "should make a successful bulk request to the Rapleaf API and return an array of infos" do
|
14
|
+
result = @dolmade.lookup_by_email(['jordan@fiftyfootfoghorn.com','polobv@gmail.com'])
|
15
|
+
result.each do |r|
|
16
|
+
r.class.should eq(Dolmade::Person)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
13
20
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dolmade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jordan Sitkin
|