edh 0.1 → 0.2
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/changelog.md +5 -0
- data/lib/edh/api.rb +4 -3
- data/lib/edh/test_users.rb +2 -2
- data/lib/edh/version.rb +1 -1
- data/readme.md +4 -2
- data/spec/cases/api_spec.rb +3 -3
- data/spec/support/edh_test.rb +1 -1
- metadata +2 -2
data/changelog.md
CHANGED
data/lib/edh/api.rb
CHANGED
@@ -8,9 +8,10 @@ module EDH
|
|
8
8
|
# @param [String] access_token access token
|
9
9
|
# @note If no access token is provided, you can only access some public information.
|
10
10
|
# @return [EDH::Passport::API] the API client
|
11
|
-
def initialize
|
12
|
-
@access_token = access_token
|
13
|
-
@
|
11
|
+
def initialize options = {}
|
12
|
+
@access_token = options[:access_token]
|
13
|
+
@app_access_token = options[:app_token]
|
14
|
+
@server = options[:server]
|
14
15
|
end
|
15
16
|
|
16
17
|
attr_accessor :access_token
|
data/lib/edh/test_users.rb
CHANGED
@@ -139,8 +139,8 @@ module EDH
|
|
139
139
|
raise ArgumentError, "TestUsers#befriend requires hash arguments for both users with id and access_token"
|
140
140
|
end
|
141
141
|
|
142
|
-
u1_graph_api = API.new(user1_token)
|
143
|
-
u2_graph_api = API.new(user2_token)
|
142
|
+
u1_graph_api = API.new(:access_token => user1_token)
|
143
|
+
u2_graph_api = API.new(:access_token => user2_token)
|
144
144
|
|
145
145
|
u1_graph_api.graph_call("#{user1_id}/friends/#{user2_id}", {}, "post", options) &&
|
146
146
|
u2_graph_api.graph_call("#{user2_id}/friends/#{user1_id}", {}, "post", options)
|
data/lib/edh/version.rb
CHANGED
data/readme.md
CHANGED
@@ -4,9 +4,11 @@
|
|
4
4
|
$passport_client = EDH::Passport::API.new
|
5
5
|
```
|
6
6
|
|
7
|
-
####optional
|
7
|
+
####optional
|
8
8
|
```ruby
|
9
|
-
|
9
|
+
#options: app_token, server, access_token (user)
|
10
|
+
#access_token is used for sending requests first, then falls back to app_token if that exists.
|
11
|
+
$passport_client = EDH::Passport::API.new(:server => "http://dummy-passport.dev")
|
10
12
|
```
|
11
13
|
####set the user token
|
12
14
|
```ruby
|
data/spec/cases/api_spec.rb
CHANGED
@@ -18,7 +18,7 @@ describe "EDH::Passport::API" do
|
|
18
18
|
|
19
19
|
it "includes an access token if given" do
|
20
20
|
token = 'adfadf'
|
21
|
-
service = EDH::Passport::API.new token
|
21
|
+
service = EDH::Passport::API.new(:access_token => token)
|
22
22
|
|
23
23
|
EDH.should_receive(:make_request).with(
|
24
24
|
anything,
|
@@ -32,7 +32,7 @@ describe "EDH::Passport::API" do
|
|
32
32
|
|
33
33
|
it "has an attr_reader for access token" do
|
34
34
|
token = 'adfadf'
|
35
|
-
service = EDH::Passport::API.new token
|
35
|
+
service = EDH::Passport::API.new(:access_token => token)
|
36
36
|
service.access_token.should == token
|
37
37
|
end
|
38
38
|
|
@@ -127,7 +127,7 @@ describe "EDH::Passport::API" do
|
|
127
127
|
|
128
128
|
describe "with an access token" do
|
129
129
|
before(:each) do
|
130
|
-
@api = EDH::Passport::API.new(@token)
|
130
|
+
@api = EDH::Passport::API.new(:access_token => @token)
|
131
131
|
end
|
132
132
|
|
133
133
|
it_should_behave_like "EDH RestAPI"
|
data/spec/support/edh_test.rb
CHANGED
@@ -121,7 +121,7 @@ module EDHTest
|
|
121
121
|
def self.validate_user_info(token)
|
122
122
|
print "Validating permissions for live testing..."
|
123
123
|
# make sure we have the necessary permissions
|
124
|
-
api = EDH::Passport::API.new(token)
|
124
|
+
api = EDH::Passport::API.new(:access_token => token)
|
125
125
|
perms = api.fql_query("select #{testing_permissions} from permissions where uid = me()")[0]
|
126
126
|
perms.each_pair do |perm, value|
|
127
127
|
if value == (perm == "read_insights" ? 1 : 0) # live testing depends on insights calls failing
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-05-
|
13
|
+
date: 2013-05-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|