github_api 0.9.6 → 0.9.7
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/README.md +1 -1
- data/features/cassettes/gists/gists/public_all.yml +222 -85
- data/features/cassettes/repos/list_repos.yml +761 -89
- data/features/cassettes/users/keys/user.yml +64 -0
- data/features/cassettes/users/keys/user_all.yml +91 -0
- data/features/gists.feature +3 -1
- data/features/repos.feature +3 -1
- data/features/users/keys.feature +27 -0
- data/lib/github_api/gists.rb +8 -3
- data/lib/github_api/issues.rb +0 -3
- data/lib/github_api/orgs/members.rb +2 -2
- data/lib/github_api/repos.rb +10 -10
- data/lib/github_api/repos/keys.rb +2 -4
- data/lib/github_api/users/keys.rb +12 -2
- data/lib/github_api/version.rb +1 -1
- data/spec/github/gists/list_spec.rb +2 -2
- data/spec/github/repos/list_spec.rb +3 -4
- data/spec/github/users/keys/list_spec.rb +31 -3
- metadata +37 -34
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://<BASIC_AUTH>@api.github.com/user/keys?access_token=<TOKEN>
|
|
6
|
+
body:
|
|
7
|
+
encoding: US-ASCII
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Accept:
|
|
11
|
+
- application/vnd.github.v3.full+json,application/vnd.github.beta.full+json;q=0.7,application/vnd.github+json;q=0.5,application/json;q=0.1
|
|
12
|
+
Accept-Charset:
|
|
13
|
+
- utf-8
|
|
14
|
+
User-Agent:
|
|
15
|
+
- Github Ruby Gem 0.9.6
|
|
16
|
+
Content-Type:
|
|
17
|
+
- application/json
|
|
18
|
+
Accept-Encoding:
|
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Server:
|
|
26
|
+
- GitHub.com
|
|
27
|
+
Date:
|
|
28
|
+
- Wed, 10 Apr 2013 21:32:31 GMT
|
|
29
|
+
Content-Type:
|
|
30
|
+
- application/json; charset=utf-8
|
|
31
|
+
Connection:
|
|
32
|
+
- keep-alive
|
|
33
|
+
Status:
|
|
34
|
+
- 200 OK
|
|
35
|
+
X-Ratelimit-Limit:
|
|
36
|
+
- '5000'
|
|
37
|
+
X-Ratelimit-Remaining:
|
|
38
|
+
- '4998'
|
|
39
|
+
Vary:
|
|
40
|
+
- Accept, Authorization, Cookie
|
|
41
|
+
Cache-Control:
|
|
42
|
+
- private, max-age=60, s-maxage=60
|
|
43
|
+
Last-Modified:
|
|
44
|
+
- Wed, 23 Jan 2013 10:27:19 GMT
|
|
45
|
+
Etag:
|
|
46
|
+
- ! '"35217ca008626c2edeb80604cf854530"'
|
|
47
|
+
X-Github-Media-Type:
|
|
48
|
+
- github.v3; param=full; format=json
|
|
49
|
+
X-Content-Type-Options:
|
|
50
|
+
- nosniff
|
|
51
|
+
Content-Length:
|
|
52
|
+
- '2'
|
|
53
|
+
Access-Control-Allow-Credentials:
|
|
54
|
+
- 'true'
|
|
55
|
+
Access-Control-Expose-Headers:
|
|
56
|
+
- Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-OAuth-Scopes, X-Accepted-OAuth-Scopes
|
|
57
|
+
Access-Control-Allow-Origin:
|
|
58
|
+
- ! '*'
|
|
59
|
+
body:
|
|
60
|
+
encoding: US-ASCII
|
|
61
|
+
string: ! '[]'
|
|
62
|
+
http_version: !!null
|
|
63
|
+
recorded_at: Wed, 10 Apr 2013 21:32:32 GMT
|
|
64
|
+
recorded_with: VCR 2.4.0
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://<BASIC_AUTH>@api.github.com/users/wycats/keys?access_token=<TOKEN>
|
|
6
|
+
body:
|
|
7
|
+
encoding: US-ASCII
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Accept:
|
|
11
|
+
- application/vnd.github.v3.full+json,application/vnd.github.beta.full+json;q=0.7,application/vnd.github+json;q=0.5,application/json;q=0.1
|
|
12
|
+
Accept-Charset:
|
|
13
|
+
- utf-8
|
|
14
|
+
User-Agent:
|
|
15
|
+
- Github Ruby Gem 0.9.6
|
|
16
|
+
Content-Type:
|
|
17
|
+
- application/json
|
|
18
|
+
Accept-Encoding:
|
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Server:
|
|
26
|
+
- GitHub.com
|
|
27
|
+
Date:
|
|
28
|
+
- Wed, 10 Apr 2013 21:30:59 GMT
|
|
29
|
+
Content-Type:
|
|
30
|
+
- application/json; charset=utf-8
|
|
31
|
+
Transfer-Encoding:
|
|
32
|
+
- chunked
|
|
33
|
+
Connection:
|
|
34
|
+
- keep-alive
|
|
35
|
+
Status:
|
|
36
|
+
- 200 OK
|
|
37
|
+
X-Ratelimit-Limit:
|
|
38
|
+
- '5000'
|
|
39
|
+
X-Ratelimit-Remaining:
|
|
40
|
+
- '4999'
|
|
41
|
+
Vary:
|
|
42
|
+
- Accept, Authorization, Cookie
|
|
43
|
+
Cache-Control:
|
|
44
|
+
- private, max-age=60, s-maxage=60
|
|
45
|
+
Last-Modified:
|
|
46
|
+
- Wed, 10 Apr 2013 21:28:41 GMT
|
|
47
|
+
Etag:
|
|
48
|
+
- ! '"f2cb84edaf3717927473ca494e9fa1ec"'
|
|
49
|
+
X-Github-Media-Type:
|
|
50
|
+
- github.v3; param=full; format=json
|
|
51
|
+
X-Content-Type-Options:
|
|
52
|
+
- nosniff
|
|
53
|
+
Access-Control-Allow-Credentials:
|
|
54
|
+
- 'true'
|
|
55
|
+
Access-Control-Expose-Headers:
|
|
56
|
+
- Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-OAuth-Scopes, X-Accepted-OAuth-Scopes
|
|
57
|
+
Access-Control-Allow-Origin:
|
|
58
|
+
- ! '*'
|
|
59
|
+
Content-Encoding:
|
|
60
|
+
- gzip
|
|
61
|
+
body:
|
|
62
|
+
encoding: ASCII-8BIT
|
|
63
|
+
string: !binary |-
|
|
64
|
+
H4sIAAAAAAAAA4ySya6jVhRFfyXy1BXRYyipBvRg+sZcICMMvjZwAZseovx7
|
|
65
|
+
XhIpybD24EhbOpOttX77/VSVp+8EcyFY/Nupeeyn76dxfP06jPkvwldEyjly
|
|
66
|
+
idgLUvm7GuvX9RXhEh3qnu5lT3AmqxtiRXZXWyR64pjijF8tOsI2uVSOrFi2
|
|
67
|
+
qekID9ZUgyK+DLRRRp+a5yV2XByKuQK8aXSM9x57bakeKWJ8WlR2nzRwFPcl
|
|
68
|
+
TMRlennmWiEBzcXQUvm8NKlQ41vFWkWIW30ZAooQ4+bpluL5LWNdYVj17DRa
|
|
69
|
+
OCYPaA18wxu3xORwz+gZnxn4WMwifYHLcb4jHsUX4MdI5G/yTAF6I+WzapeD
|
|
70
|
+
6xt64IWLRIuQHMzwM5tX151izMwdk7pPM/O5A4Qleaq5kXnDu0Lsq6kTDPZD
|
|
71
|
+
1J+Int49f1gGJE27Nbt+CFRC0txrhMV9Uc/ZI0DLvJpU6w+f+YMBrTIeA1h/
|
|
72
|
+
/Dj98e0fJBzL0zj700gMRXgz9CXpcGDCcuTiCbVa6ErHh2+JIKtrZhJEmgPk
|
|
73
|
+
cURX6jLlKuvUX98UXjyJ2KfohuBriwgLvIpWvZ/fRGRjIO3SfMO8NtbBK14V
|
|
74
|
+
ez0LM7y6h9NvV6Puet6doDLGN4qlJNhmVacBnBRVw5mW7UmqBl/C3utlkXlG
|
|
75
|
+
zgg13fIs9KrD8b+ZPMNQNPETM2XBF8S/DBR86SwJyHnYY6HFcZkmzfLSUGUk
|
|
76
|
+
Q92cw6ZMIsq1dZh0KCMUObIBg1zMv28g2EmdasYLOw+F12RBhwAGkCQpZnT3
|
|
77
|
+
NFIAKq9cg7FwwUZIhh2lb+/JjiQ3TN1aHBxJcalrK63K6FIuGXCoxmuZ8Afz
|
|
78
|
+
8EJUBHlKkox+wJsGXn01P3Zrarh3AjnOrznMxix0yY5HYJoqfN54UhZaiLh0
|
|
79
|
+
h+uR3nCHC9cSY0c9mfsEdhA5btc+oSjKdecY76yfAsGpaTLzAxD3y9Pt8o9n
|
|
80
|
+
Z8ey3fA0JYc9+7BcfPWPxvabEelkLosGBYa2sy9pUsUhc952ORrtI6T5ea7c
|
|
81
|
+
j7TNGRm0ShSILms1c/CvecSFYn5Ovf8xkX3A1vHZdyVlSFi1cAn/3lnmfd+i
|
|
82
|
+
hMJbbJkYzFO3Te/j9zjG86AC+4UxJaELxnYnlaVmtk1kWmnHk7ONczf0Z0Pz
|
|
83
|
+
st0QEAAA9F+6taDEY5YSqom3MCLndFFvmQcNZsQ5/ff2/sAVCu/W5HkY0avS
|
|
84
|
+
LQ2ypKFWzWNk3CkRaCO2I8PUeShr5WSOG2umpNl8eAHycMyxl097LBVgpiBt
|
|
85
|
+
ycB8nOjQMTXbPL5GFU77pPC2E7439N+cAT80rNZ5PfZnbwgQ/RT02euKn0y5
|
|
86
|
+
EDACXcR0aG+af0nrpA9aCydY3ApsbCjcjzmvSjliEQbPMLdUltaLBM2oC66l
|
|
87
|
+
jtaayFkpZyiw+FS51onEh9I2Fjjz90BbQxcq2pAYrvv072hvINuBminEgPiD
|
|
88
|
+
u/vb79cfKh9lsKIFAAA=
|
|
89
|
+
http_version: !!null
|
|
90
|
+
recorded_at: Wed, 10 Apr 2013 21:30:59 GMT
|
|
91
|
+
recorded_with: VCR 2.4.0
|
data/features/gists.feature
CHANGED
|
@@ -16,7 +16,9 @@ Feature: Gists API
|
|
|
16
16
|
|
|
17
17
|
Scenario: List public gists
|
|
18
18
|
|
|
19
|
-
Given I want to list resources
|
|
19
|
+
Given I want to list resources with the following params:
|
|
20
|
+
| public |
|
|
21
|
+
| public |
|
|
20
22
|
When I make request within a cassette named "gists/gists/public_all"
|
|
21
23
|
Then the response status should be 200
|
|
22
24
|
And the response type should be JSON
|
data/features/repos.feature
CHANGED
|
@@ -46,7 +46,9 @@ Feature: Repositories API
|
|
|
46
46
|
|
|
47
47
|
Scenario: All repositories
|
|
48
48
|
|
|
49
|
-
Given I want to list resources
|
|
49
|
+
Given I want to list resources with the following params:
|
|
50
|
+
| every |
|
|
51
|
+
| every |
|
|
50
52
|
When I make request within a cassette named "repos/list_repos"
|
|
51
53
|
Then the response status should be 200
|
|
52
54
|
And the response type should be JSON
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Feature: Accessing Users Keys API
|
|
2
|
+
|
|
3
|
+
In order to interact with github user keys
|
|
4
|
+
GithubAPI gem
|
|
5
|
+
Should return the expected results depending on passed parameters
|
|
6
|
+
|
|
7
|
+
Background:
|
|
8
|
+
Given I have "Github::Users::Keys" instance
|
|
9
|
+
|
|
10
|
+
Scenario: Lists all public keys for a user
|
|
11
|
+
|
|
12
|
+
Given I want to list resources
|
|
13
|
+
And I pass the following request options:
|
|
14
|
+
| user |
|
|
15
|
+
| wycats |
|
|
16
|
+
When I make request within a cassette named "users/keys/user_all"
|
|
17
|
+
Then the response status should be 200
|
|
18
|
+
And the response type should be JSON
|
|
19
|
+
And the response should not be empty
|
|
20
|
+
|
|
21
|
+
Scenario: Lists all public keys for the authenticted user
|
|
22
|
+
|
|
23
|
+
Given I want to list resources
|
|
24
|
+
When I make request within a cassette named "users/keys/user"
|
|
25
|
+
Then the response status should be 200
|
|
26
|
+
And the response type should be JSON
|
|
27
|
+
And the response should be empty
|
data/lib/github_api/gists.rb
CHANGED
|
@@ -32,15 +32,20 @@ module Github
|
|
|
32
32
|
# github = Github.new :oauth_token => '...'
|
|
33
33
|
# github.gists.list
|
|
34
34
|
#
|
|
35
|
+
# List all public gists
|
|
36
|
+
#
|
|
37
|
+
# github = Github.new
|
|
38
|
+
# github.gists.list :public
|
|
39
|
+
#
|
|
35
40
|
def list(*args)
|
|
36
41
|
params = arguments(args).params
|
|
37
42
|
|
|
38
43
|
response = if (user = params.delete('user'))
|
|
39
44
|
get_request("/users/#{user}/gists", params)
|
|
40
|
-
elsif
|
|
41
|
-
get_request("/gists", params)
|
|
42
|
-
else
|
|
45
|
+
elsif args.map(&:to_s).include?('public')
|
|
43
46
|
get_request("/gists/public", params)
|
|
47
|
+
else
|
|
48
|
+
get_request("/gists", params)
|
|
44
49
|
end
|
|
45
50
|
return response unless block_given?
|
|
46
51
|
response.each { |el| yield el }
|
data/lib/github_api/issues.rb
CHANGED
|
@@ -139,9 +139,6 @@ module Github
|
|
|
139
139
|
params = arguments(args) do
|
|
140
140
|
assert_values VALID_ISSUE_PARAM_VALUES
|
|
141
141
|
end.params
|
|
142
|
-
# filter! VALID_ISSUE_PARAM_NAMES, params
|
|
143
|
-
# _merge_mime_type(:issue, params)
|
|
144
|
-
# assert_valid_values(VALID_ISSUE_PARAM_VALUES, params)
|
|
145
142
|
|
|
146
143
|
response = if (org = params.delete('org'))
|
|
147
144
|
get_request("/orgs/#{org}/issues", params)
|
|
@@ -21,8 +21,8 @@ module Github
|
|
|
21
21
|
# Members of an organization can choose to have their membership publicized or not.
|
|
22
22
|
# = Examples
|
|
23
23
|
# github = Github.new
|
|
24
|
-
# github.orgs.members.list 'org-name', :
|
|
25
|
-
# github.orgs.members.list 'org-name', :
|
|
24
|
+
# github.orgs.members.list 'org-name', public: true
|
|
25
|
+
# github.orgs.members.list 'org-name', public: true { |memb| ... }
|
|
26
26
|
#
|
|
27
27
|
def list(*args)
|
|
28
28
|
params = arguments(args, :required => [:org_name]).params
|
data/lib/github_api/repos.rb
CHANGED
|
@@ -114,26 +114,26 @@ module Github
|
|
|
114
114
|
#
|
|
115
115
|
# = Examples
|
|
116
116
|
# github = Github.new
|
|
117
|
-
# github.repos.list
|
|
118
|
-
# github.repos.list { |repo| ... }
|
|
117
|
+
# github.repos.list every: true
|
|
118
|
+
# github.repos.list every: true { |repo| ... }
|
|
119
119
|
#
|
|
120
120
|
# List public repositories for the specified user.
|
|
121
121
|
#
|
|
122
122
|
# = Examples
|
|
123
123
|
# github = Github.new
|
|
124
|
-
# github.repos.list :
|
|
125
|
-
# github.repos.list :
|
|
124
|
+
# github.repos.list user: 'user-name'
|
|
125
|
+
# github.repos.list user: 'user-name', { |repo| ... }
|
|
126
126
|
#
|
|
127
127
|
# List repositories for the specified organisation.
|
|
128
128
|
#
|
|
129
129
|
# = Examples
|
|
130
130
|
# github = Github.new
|
|
131
|
-
# github.repos.list :
|
|
132
|
-
# github.repos.list :
|
|
131
|
+
# github.repos.list org: 'org-name'
|
|
132
|
+
# github.repos.list org: 'org-name', { |repo| ... }
|
|
133
133
|
#
|
|
134
134
|
def list(*args)
|
|
135
135
|
arguments(args) do
|
|
136
|
-
sift %w[ user org type sort direction ]
|
|
136
|
+
sift %w[ user org type sort direction since ]
|
|
137
137
|
end
|
|
138
138
|
params = arguments.params
|
|
139
139
|
|
|
@@ -141,11 +141,11 @@ module Github
|
|
|
141
141
|
get_request("/users/#{user_name}/repos", params)
|
|
142
142
|
elsif (org_name = (params.delete("org")))
|
|
143
143
|
get_request("/orgs/#{org_name}/repos", params)
|
|
144
|
-
elsif
|
|
144
|
+
elsif args.map(&:to_s).include?("every")
|
|
145
|
+
get_request("/repositories", params)
|
|
146
|
+
else
|
|
145
147
|
# For authenticated user
|
|
146
148
|
get_request("/user/repos", params)
|
|
147
|
-
else
|
|
148
|
-
get_request("/repositories", params)
|
|
149
149
|
end
|
|
150
150
|
return response unless block_given?
|
|
151
151
|
response.each { |el| yield el }
|
|
@@ -17,9 +17,8 @@ module Github
|
|
|
17
17
|
#
|
|
18
18
|
def list(*args)
|
|
19
19
|
arguments(args, :required => [:user, :repo])
|
|
20
|
-
params = arguments.params
|
|
21
20
|
|
|
22
|
-
response = get_request("/repos/#{user}/#{repo}/keys", params)
|
|
21
|
+
response = get_request("/repos/#{user}/#{repo}/keys", arguments.params)
|
|
23
22
|
return response unless block_given?
|
|
24
23
|
response.each { |el| yield el }
|
|
25
24
|
end
|
|
@@ -33,9 +32,8 @@ module Github
|
|
|
33
32
|
#
|
|
34
33
|
def get(*args)
|
|
35
34
|
arguments(args, :required => [:user, :repo, :key_id])
|
|
36
|
-
params = arguments.params
|
|
37
35
|
|
|
38
|
-
get_request("/repos/#{user}/#{repo}/keys/#{key_id}", params)
|
|
36
|
+
get_request("/repos/#{user}/#{repo}/keys/#{key_id}", arguments.params)
|
|
39
37
|
end
|
|
40
38
|
alias :find :get
|
|
41
39
|
|
|
@@ -12,9 +12,19 @@ module Github
|
|
|
12
12
|
# github.users.keys.list
|
|
13
13
|
# github.users.keys.list { |key| ... }
|
|
14
14
|
#
|
|
15
|
+
# List public keys for the specified user
|
|
16
|
+
#
|
|
17
|
+
# = Examples
|
|
18
|
+
# github.users.keys.list user: 'user-name'
|
|
19
|
+
# github.users.keys.list user: 'user-name' { |key| ... }
|
|
20
|
+
#
|
|
15
21
|
def list(*args)
|
|
16
|
-
arguments(args)
|
|
17
|
-
response =
|
|
22
|
+
params = arguments(args).params
|
|
23
|
+
response = if (user = params.delete('user'))
|
|
24
|
+
get_request("/users/#{user}/keys", params)
|
|
25
|
+
else
|
|
26
|
+
get_request("/user/keys", params)
|
|
27
|
+
end
|
|
18
28
|
return response unless block_given?
|
|
19
29
|
response.each { |el| yield el }
|
|
20
30
|
end
|
data/lib/github_api/version.rb
CHANGED
|
@@ -50,12 +50,12 @@ describe Github::Gists, '#list' do
|
|
|
50
50
|
let(:request_path) { "/gists/public" }
|
|
51
51
|
|
|
52
52
|
it "should get the resources" do
|
|
53
|
-
subject.list
|
|
53
|
+
subject.list :public
|
|
54
54
|
a_get(request_path).should have_been_made
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
it_should_behave_like 'an array of resources' do
|
|
58
|
-
let(:requestable) { subject.list }
|
|
58
|
+
let(:requestable) { subject.list :public }
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
@@ -26,10 +26,10 @@ describe Github::Repos, '#list' do
|
|
|
26
26
|
|
|
27
27
|
it "falls back to all if user is unauthenticated" do
|
|
28
28
|
subject.oauth_token = nil
|
|
29
|
-
stub_get("/
|
|
29
|
+
stub_get("/user/repos").to_return(:body => '[]', :status => 200,
|
|
30
30
|
:headers => {:content_type => "application/json; charset=utf-8"} )
|
|
31
31
|
subject.list
|
|
32
|
-
a_get('/
|
|
32
|
+
a_get('/user/repos').should have_been_made
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
it "should get the resources" do
|
|
@@ -67,10 +67,9 @@ describe Github::Repos, '#list' do
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
it "should get the resources" do
|
|
70
|
-
subject.list
|
|
70
|
+
subject.list :every
|
|
71
71
|
a_get(request_path).should have_been_made
|
|
72
72
|
end
|
|
73
|
-
|
|
74
73
|
end
|
|
75
74
|
|
|
76
75
|
context "resource found for organization" do
|
|
@@ -4,7 +4,6 @@ require 'spec_helper'
|
|
|
4
4
|
|
|
5
5
|
describe Github::Users::Keys, '#list' do
|
|
6
6
|
let(:key_id) { 1 }
|
|
7
|
-
let(:request_path) { "/user/keys" }
|
|
8
7
|
|
|
9
8
|
before {
|
|
10
9
|
subject.oauth_token = OAUTH_TOKEN
|
|
@@ -16,6 +15,7 @@ describe Github::Users::Keys, '#list' do
|
|
|
16
15
|
after { reset_authentication_for(subject) }
|
|
17
16
|
|
|
18
17
|
context "resource found for an authenticated user" do
|
|
18
|
+
let(:request_path) { "/user/keys" }
|
|
19
19
|
let(:body) { fixture('users/keys.json') }
|
|
20
20
|
let(:status) { 200 }
|
|
21
21
|
|
|
@@ -41,10 +41,38 @@ describe Github::Users::Keys, '#list' do
|
|
|
41
41
|
result = subject.list { |obj| yielded << obj }
|
|
42
42
|
yielded.should == result
|
|
43
43
|
end
|
|
44
|
+
|
|
45
|
+
it_should_behave_like 'request failure' do
|
|
46
|
+
let(:requestable) { subject.list }
|
|
47
|
+
end
|
|
44
48
|
end
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
let(:
|
|
50
|
+
context "resource found for a user" do
|
|
51
|
+
let(:user) { 'peter-murach' }
|
|
52
|
+
let(:body) { fixture('users/keys.json') }
|
|
53
|
+
let(:status) { 200 }
|
|
54
|
+
let(:request_path) { "/users/#{user}/keys" }
|
|
55
|
+
|
|
56
|
+
it "should get the resources" do
|
|
57
|
+
subject.list :user => user
|
|
58
|
+
a_get(request_path).with(:query => { :access_token => "#{OAUTH_TOKEN}"}).
|
|
59
|
+
should have_been_made
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it_should_behave_like 'an array of resources' do
|
|
63
|
+
let(:requestable) { subject.list :user => user }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "should get keys information" do
|
|
67
|
+
keys = subject.list :user => user
|
|
68
|
+
keys.first.id.should == key_id
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "should yield to a block" do
|
|
72
|
+
yielded = []
|
|
73
|
+
result = subject.list(:user => user) { |obj| yielded << obj }
|
|
74
|
+
yielded.should == result
|
|
75
|
+
end
|
|
48
76
|
end
|
|
49
77
|
|
|
50
78
|
end # list
|