hyper-graph 0.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -35,7 +35,7 @@ Usage
35
35
  Supports 'ID' and 'ID/CONNECTION_TYPE' API requests using GET, POST and DELETE. HyperGraph parses the API's JSON response into a Ruby-friendly format.
36
36
  [Read up on the API](http://developers.facebook.com/docs/api) to learn what that means.
37
37
 
38
- Version 0.3 introduces a new, friendlier HyperGraph API. If you're familiar with previous versions, review the updated API but don't worry: the new API 100% backward compatible.
38
+ Version 0.3 introduces a new, friendlier HyperGraph API. If you're familiar with previous versions, review the updated API but don't worry: the new API is 100% backward compatible.
39
39
 
40
40
  Create a HyperGraph to store your access token:
41
41
  irb > graph = HyperGraph.new('my-access-token')
@@ -44,6 +44,9 @@ Create a HyperGraph to store your access token:
44
44
  You can load an object and make requests against it:
45
45
  irb > me = graph.object(518018845)
46
46
  => #<HyperGraphObject:0x1945934 @id="518018845" @access_token="my-access-token">
47
+ irb > me = graph.object(518018845).get
48
+ => {:updated_time=>Wed Mar 17 16:19:03 -0400 2010, :first_name=>"Chris", :last_name=>"Dinn", ...
49
+
47
50
  You can make connection requests, too:
48
51
  irb > me.get(:likes)
49
52
  => [{:category=>"Websites", :name=>"Slate.com", :id=>21516776437}]
data/lib/hyper_graph.rb CHANGED
@@ -116,13 +116,7 @@ class HyperGraph
116
116
  end
117
117
 
118
118
  def normalize_array(array)
119
- array.collect{ |item| normalize_response(item) }.sort do |a, b|
120
- if a[:id] && b[:id]
121
- a[:id] <=> b[:id]
122
- elsif a[:name]&&b[:name]
123
- a[:name] <=> b[:name]
124
- end
125
- end
119
+ array.collect{ |item| normalize_response(item) }
126
120
  end
127
121
 
128
122
  # Extracts data from "data" key in Hash, if present
@@ -44,7 +44,10 @@ class HyperGraphObjectTest < Test::Unit::TestCase
44
44
  graph = HyperGraph.new(access_token)
45
45
  graph_object = graph.object('518018845')
46
46
 
47
- assert_equal expected_sorted_array, graph_object.get(:friends)
47
+ friends = graph_object.get(:friends)
48
+ expected_sorted_array.each do |friend|
49
+ assert friends.include?(friend)
50
+ end
48
51
  end
49
52
 
50
53
  def test_post_request_returning_true
@@ -53,7 +53,10 @@ class HyperGraphTest < Test::Unit::TestCase
53
53
  @mock_connection.expects(:use_ssl=).with(true)
54
54
  @mock_connection.stubs(:get).with("/518018845/friends?access_token=#{access_token}").returns(mock_response)
55
55
 
56
- assert_equal expected_sorted_array, HyperGraph.get('518018845/friends', :access_token => access_token)
56
+ friends = HyperGraph.get('518018845/friends', :access_token => access_token)
57
+ expected_sorted_array.each do |friend|
58
+ assert friends.include?(friend)
59
+ end
57
60
  end
58
61
 
59
62
  def test_object_pagination
metadata CHANGED
@@ -5,7 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- version: "0.3"
8
+ - 1
9
+ version: 0.3.1
9
10
  platform: ruby
10
11
  authors:
11
12
  - Chris Dinn
@@ -13,7 +14,7 @@ autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
16
 
16
- date: 2010-04-29 00:00:00 -04:00
17
+ date: 2010-05-04 00:00:00 -04:00
17
18
  default_executable:
18
19
  dependencies:
19
20
  - !ruby/object:Gem::Dependency