giggly 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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/lib/giggly/rest.rb CHANGED
@@ -22,6 +22,7 @@ module Giggly
22
22
  class RequestEntityTooLarge < SocializeError; end
23
23
  class InternalServerError < SocializeError; end
24
24
  class NotImplemented < SocializeError; end
25
+ class LengthRequired < SocializeError; end
25
26
 
26
27
  end
27
28
  end
@@ -5,6 +5,8 @@ module Giggly
5
5
  attr_accessor :api_key, :secret_key, :uid
6
6
  format :xml
7
7
 
8
+ headers 'Content-Length' => '0'
9
+
8
10
  # Accepts a hash of connection parameters that will be used to authenticate requests with gigya
9
11
  # and specify the user that the request is specific to. The keys for the has are all symbols.
10
12
  # The connection parameter hash requires :api_key, :secret_key, and :uid
@@ -34,7 +36,7 @@ module Giggly
34
36
 
35
37
  def sign(http_method, api_url, params)
36
38
  params.merge! "apiKey" => @api_key, "uid" => @uid
37
- params.merge "sig" => signature(api_url, http_method, params)
39
+ params.merge "sig" => signature(http_method, api_url, params)
38
40
  end
39
41
 
40
42
  def signature(http_method, api_url, params)
@@ -71,6 +73,8 @@ module Giggly
71
73
  raise Giggly::Rest::Forbidden.new(data)
72
74
  when 404
73
75
  raise Giggly::Rest::NotFound.new(data)
76
+ when 411
77
+ raise Giggly::Rest::LengthRequired.new(data)
74
78
  when 413
75
79
  raise Giggly::Rest::RequestEntityTooLarge.new(data)
76
80
  when 500
@@ -37,7 +37,7 @@ module Giggly
37
37
  def friends_info(options = {})
38
38
  validate_providers! %w[facebook yahoo myspace twitter], options[:enabled_providers]
39
39
  params = provider_hash(options)
40
- params[:UIDs], params[:detailLevel] = options[:uids], options[:detailLevel]
40
+ params[:user_ids], params[:detail_level] = options[:uids], options[:detailLevel]
41
41
 
42
42
  response = perform_post(:getFriendsInfo, params)
43
43
  friends = []
@@ -147,4 +147,4 @@ module Giggly
147
147
 
148
148
  end
149
149
  end
150
- end
150
+ end
@@ -5,7 +5,7 @@ class Giggly::Rest::RequestTest < Test::Unit::TestCase
5
5
  context "A Giggly::Rest::Request instance" do
6
6
  setup do
7
7
  @request = Giggly::Rest::Request.new(
8
- :api_key => 'TEST_KEY',
8
+ :api_key => 'API_KEY',
9
9
  :secret_key => 'SECRET_KEY',
10
10
  :user_id => 'GIGYA_USER_ID'
11
11
  )
@@ -16,9 +16,9 @@ class Giggly::Rest::RequestTest < Test::Unit::TestCase
16
16
  # currently works with gigya, see http://twitter.com/_ah/status/4567114726
17
17
  # which was posted from irb using Giggly
18
18
  should "create a valid signature" do
19
- Time.stubs(:now).returns(1254940826)
19
+ Time.stubs(:now).returns(1255116790)
20
20
  params = @request.sign('POST', "#{Giggly::Rest::Socialize::GIGYA_URL}getUserInfo", {})
21
- 'olilJCSJzaBmzb9tsHH8LmJpYp0='.should == params['sig']
21
+ 'GqCzS7ByQg8fgJa5T6k1DVFcSDg='.should == params['sig']
22
22
  end
23
23
 
24
24
  end
@@ -16,7 +16,7 @@ class Giggly::Rest::SocializeTest < Test::Unit::TestCase
16
16
  should "get friends info and return array of Giggly::Friend objects" do
17
17
  FakeSocialize.setup_response(:friends_info, :success)
18
18
  friends = @giggly.friends_info
19
- assert friends.size > 0
19
+ friends.size.should > 0
20
20
  friends.each do |friend|
21
21
  friend.class.should == Giggly::Friend
22
22
  end
@@ -80,8 +80,7 @@ class Giggly::Rest::SocializeTest < Test::Unit::TestCase
80
80
 
81
81
  should "send notification to users friends" do
82
82
  FakeSocialize.setup_response(:send_notification, :success)
83
- #response = @giggly.send_notification %w[_gigya_uid1 _gigya_uid2], 'this is a test', 'this is only a test'
84
- response = @giggly.send_notification 'foo', 'bar', 'baz'
83
+ response = @giggly.send_notification %w[_gigya_uid1 _gigya_uid2], 'this is a test', 'this is only a test'
85
84
  response.should be_successful
86
85
  end
87
86
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: giggly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Vandgrift
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-10-08 00:00:00 -04:00
13
+ date: 2009-10-09 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency