prooflink_connect 0.0.22 → 0.0.23
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/lib/prooflink_connect/activity.rb +3 -3
- data/lib/prooflink_connect/assertion.rb +3 -3
- data/lib/prooflink_connect/invite.rb +4 -4
- data/lib/prooflink_connect/version.rb +1 -1
- data/prooflink_connect.gemspec +1 -1
- data/spec/prooflink_connect/activity_spec.rb +3 -3
- data/spec/prooflink_connect/invite_spec.rb +4 -4
- metadata +4 -4
@@ -25,11 +25,11 @@ module ProoflinkConnect
|
|
25
25
|
|
26
26
|
begin
|
27
27
|
response = access_token.post 'api/v2/activities', :body => {:activity => params}
|
28
|
-
return
|
28
|
+
return MultiJson.decode(response.body)
|
29
29
|
|
30
30
|
rescue OAuth2::Error => error
|
31
|
-
return
|
31
|
+
return MultiJson.decode(error.response.body)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
|
-
end
|
35
|
+
end
|
@@ -36,8 +36,8 @@ module ProoflinkConnect
|
|
36
36
|
resp = http.post(url.path, data)
|
37
37
|
if resp.code == '200'
|
38
38
|
begin
|
39
|
-
data =
|
40
|
-
rescue
|
39
|
+
data = MultiJson.decode(resp.body)
|
40
|
+
rescue MultiJson::DecodeError => err
|
41
41
|
raise AuthinfoException.new(resp), "Unable to parse JSON response: #{resp.body.inspect}"
|
42
42
|
end
|
43
43
|
else
|
@@ -48,4 +48,4 @@ module ProoflinkConnect
|
|
48
48
|
class AuthinfoException < ::StandardError
|
49
49
|
end
|
50
50
|
end
|
51
|
-
end
|
51
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'httparty'
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
2
|
+
require 'active_support/core_ext/hash/keys'
|
3
|
+
require 'active_support/core_ext/hash/reverse_merge'
|
4
|
+
require 'multi_json'
|
5
5
|
|
6
6
|
class ProoflinkConnect::Invite
|
7
7
|
attr_reader :configuration, :attributes
|
@@ -21,7 +21,7 @@ class ProoflinkConnect::Invite
|
|
21
21
|
response = HTTParty.post(uri, :body => params)
|
22
22
|
|
23
23
|
if response.code == 200
|
24
|
-
self.attributes.merge!
|
24
|
+
self.attributes.merge! MultiJson.load(response.body)["entry"].stringify_keys
|
25
25
|
end
|
26
26
|
|
27
27
|
return created?
|
data/prooflink_connect.gemspec
CHANGED
@@ -8,11 +8,11 @@ describe ProoflinkConnect::Activity do
|
|
8
8
|
before do
|
9
9
|
stub_request(:post, "https://example.prooflink.com/api/v2/activities").
|
10
10
|
with(:body => {"activity"=>{"activity_type"=>{"name"=>"My name", "value"=>"1", "identifier"=>"my_identifier"}, "user"=>{"identity_provider"=>"prooflink", "email"=>"jon@doe.com"}}}, :headers => {'Accept'=>'*/*', 'Authorization'=>'OAuth 4321', 'Content-Type'=>'application/x-www-form-urlencoded'}).
|
11
|
-
to_return(:status => 200, :body => {"status"=>"SUCCESS", "message"=>"activity succesfully created"}
|
11
|
+
to_return(:status => 200, :body => MultiJson.encode({"status"=>"SUCCESS", "message"=>"activity succesfully created"}), :headers => {})
|
12
12
|
|
13
13
|
stub_request(:post, "https://example.prooflink.com/api/v2/activities").
|
14
14
|
with(:body => "", :headers => {'Accept'=>'*/*', 'Authorization'=>'OAuth 4321', 'Content-Type'=>'application/x-www-form-urlencoded'}).
|
15
|
-
to_return(:status => 406, :body => {"status"=>"ERROR", "message"=>"no activity specified"}
|
15
|
+
to_return(:status => 406, :body => MultiJson.encode({"status"=>"ERROR", "message"=>"no activity specified"}), :headers => {})
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should log activity as expected" do
|
@@ -26,4 +26,4 @@ describe ProoflinkConnect::Activity do
|
|
26
26
|
it "should not log activity when no params are passed" do
|
27
27
|
ProoflinkConnect::Activity.log({}).should eq({"status"=>"ERROR", "message"=>"no activity specified"})
|
28
28
|
end
|
29
|
-
end
|
29
|
+
end
|
@@ -11,14 +11,14 @@ describe ProoflinkConnect::Invite do
|
|
11
11
|
|
12
12
|
stub_request(:post, "https://example.prooflink.com/invites").
|
13
13
|
with{|request| expected_parameters == CGI.parse(request.body)}.
|
14
|
-
to_return(:status => 200, :body => {
|
14
|
+
to_return(:status => 200, :body => MultiJson.encode({
|
15
15
|
"entry" => {
|
16
16
|
"name" => {},
|
17
17
|
"displayName" => "Prooflink",
|
18
18
|
"id" => "cg6a1Turx70NWzkkwrbGRDRvImY=\n",
|
19
19
|
"invite_url" => "url"
|
20
20
|
}
|
21
|
-
}
|
21
|
+
}), :headers => {})
|
22
22
|
|
23
23
|
invite = ProoflinkConnect::Invite.new(attributes)
|
24
24
|
invite.save.should == true
|
@@ -32,14 +32,14 @@ describe ProoflinkConnect::Invite do
|
|
32
32
|
|
33
33
|
stub_request(:post, "https://example.prooflink.com/invites").
|
34
34
|
with{|request| expected_parameters == CGI.parse(request.body)}.
|
35
|
-
to_return(:status => 200, :body => {
|
35
|
+
to_return(:status => 200, :body => MultiJson.encode({
|
36
36
|
"entry" => {
|
37
37
|
"name" => {},
|
38
38
|
"displayName" => "Prooflink",
|
39
39
|
"id" => "cg6a1Turx70NWzkkwrbGRDRvImY=\n",
|
40
40
|
"invite_url" => "url"
|
41
41
|
}
|
42
|
-
}
|
42
|
+
}), :headers => {})
|
43
43
|
|
44
44
|
invite = ProoflinkConnect::Invite.new(attributes)
|
45
45
|
invite.save({"api_key" => "4567"}).should == true
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prooflink_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 23
|
10
|
+
version: 0.0.23
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chiel Wester
|
@@ -21,7 +21,7 @@ cert_chain: []
|
|
21
21
|
date: 2012-09-25 00:00:00 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
|
-
name:
|
24
|
+
name: multi_json
|
25
25
|
prerelease: false
|
26
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
27
27
|
none: false
|