prooflink_connect 0.0.22 → 0.0.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 JSON.parse(response.body)
28
+ return MultiJson.decode(response.body)
29
29
 
30
30
  rescue OAuth2::Error => error
31
- return JSON.parse(error.response.body)
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 = JSON.parse(resp.body)
40
- rescue JSON::ParserError => err
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 "active_support/core_ext/hash/keys"
3
- require "active_support/core_ext/hash/reverse_merge"
4
- require "json"
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! JSON.parse(response.body)["entry"].stringify_keys
24
+ self.attributes.merge! MultiJson.load(response.body)["entry"].stringify_keys
25
25
  end
26
26
 
27
27
  return created?
@@ -1,3 +1,3 @@
1
1
  module ProoflinkConnect
2
- VERSION = "0.0.22"
2
+ VERSION = "0.0.23"
3
3
  end
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.required_rubygems_version = ">= 1.3.6"
15
15
  s.rubyforge_project = "prooflink_connect"
16
16
 
17
- s.add_dependency 'json'
17
+ s.add_dependency 'multi_json'
18
18
  s.add_dependency 'httparty'
19
19
  s.add_dependency 'activesupport'
20
20
 
@@ -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"}.to_json, :headers => {})
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"}.to_json, :headers => {})
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
- }.to_json, :headers => {})
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
- }.to_json, :headers => {})
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: 51
4
+ hash: 49
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 22
10
- version: 0.0.22
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: json
24
+ name: multi_json
25
25
  prerelease: false
26
26
  requirement: &id001 !ruby/object:Gem::Requirement
27
27
  none: false