octocat_herder 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +2 -1
- data/.travis.yml +3 -0
- data/CONTRIBUTING.markdown +93 -0
- data/Gemfile +8 -6
- data/Gemfile.lock +5 -1
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.markdown +46 -0
- data/Rakefile +2 -9
- data/VERSION +1 -1
- data/lib/octocat_herder/base.rb +53 -44
- data/lib/octocat_herder/connection.rb +145 -6
- data/lib/octocat_herder/pull_request/repo.rb +38 -4
- data/lib/octocat_herder/pull_request.rb +186 -24
- data/lib/octocat_herder/repository.rb +128 -11
- data/lib/octocat_herder/user.rb +107 -8
- data/lib/octocat_herder.rb +22 -1
- data/octocat_herder.gemspec +17 -9
- data/spec/octocat_herder/connection_spec.rb +4 -4
- metadata +48 -14
- data/README.rdoc +0 -19
data/lib/octocat_herder.rb
CHANGED
@@ -1,13 +1,34 @@
|
|
1
1
|
require 'octocat_herder/connection'
|
2
2
|
require 'octocat_herder/user'
|
3
3
|
|
4
|
+
# This is just a convenience class to serve as a jumping-off point
|
5
|
+
# into the rest of the GitHub API. You don't have to use this, if you
|
6
|
+
# don't want; you can use the other classes directly, constructing
|
7
|
+
# your own OctocatHerder::Connection to pass to them.
|
8
|
+
#
|
9
|
+
# This provides convenience methods for the following:
|
10
|
+
# * OctocatHerder::User
|
4
11
|
class OctocatHerder
|
12
|
+
# The instance of OctocatHerder::Connection used for making API
|
13
|
+
# requests.
|
14
|
+
#
|
15
|
+
# @since 0.0.1
|
5
16
|
attr_reader :connection
|
6
17
|
|
18
|
+
# Get a new OctocatHerder for use with the GitHub v3 API.
|
19
|
+
#
|
20
|
+
# @since 0.0.1
|
21
|
+
# @see OctocatHerder::Connection.new
|
22
|
+
# @param [Hash] options Passed to OctocatHerder::Connection.new
|
7
23
|
def initialize(options={})
|
8
|
-
@connection = OctocatHerder::Connection.new
|
24
|
+
@connection = OctocatHerder::Connection.new(options)
|
9
25
|
end
|
10
26
|
|
27
|
+
# Fetch an OctocatHerder::User by using OctocatHerder::User.fetch
|
28
|
+
# and the OctocatHerder::Connection from #connection
|
29
|
+
#
|
30
|
+
# @since 0.0.1
|
31
|
+
# @param [String] user_name The login name of the GitHub user to retrieve.
|
11
32
|
def user(user_name)
|
12
33
|
OctocatHerder::User.fetch(user_name, connection)
|
13
34
|
end
|
data/octocat_herder.gemspec
CHANGED
@@ -5,23 +5,25 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{octocat_herder}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jacob Helwig"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-08-12}
|
13
13
|
s.description = %q{This gem provides Ruby bindings to the v3 GitHub API}
|
14
14
|
s.email = %q{jacob@technosorcery.net}
|
15
15
|
s.extra_rdoc_files = [
|
16
|
-
"LICENSE
|
17
|
-
"README.
|
16
|
+
"LICENSE",
|
17
|
+
"README.markdown"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
+
".travis.yml",
|
22
|
+
"CONTRIBUTING.markdown",
|
21
23
|
"Gemfile",
|
22
24
|
"Gemfile.lock",
|
23
|
-
"LICENSE
|
24
|
-
"README.
|
25
|
+
"LICENSE",
|
26
|
+
"README.markdown",
|
25
27
|
"Rakefile",
|
26
28
|
"VERSION",
|
27
29
|
"lib/octocat_herder.rb",
|
@@ -54,7 +56,9 @@ Gem::Specification.new do |s|
|
|
54
56
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
55
57
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
56
58
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
57
|
-
s.add_development_dependency(%q<
|
59
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
60
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.8.0"])
|
61
|
+
s.add_development_dependency(%q<bluecloth>, ["~> 2.1.0"])
|
58
62
|
else
|
59
63
|
s.add_dependency(%q<httparty>, ["~> 0.7.8"])
|
60
64
|
s.add_dependency(%q<link_header>, ["~> 0.0.5"])
|
@@ -63,7 +67,9 @@ Gem::Specification.new do |s|
|
|
63
67
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
64
68
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
65
69
|
s.add_dependency(%q<rcov>, [">= 0"])
|
66
|
-
s.add_dependency(%q<
|
70
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
71
|
+
s.add_dependency(%q<rdoc>, ["~> 3.8.0"])
|
72
|
+
s.add_dependency(%q<bluecloth>, ["~> 2.1.0"])
|
67
73
|
end
|
68
74
|
else
|
69
75
|
s.add_dependency(%q<httparty>, ["~> 0.7.8"])
|
@@ -73,7 +79,9 @@ Gem::Specification.new do |s|
|
|
73
79
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
74
80
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
75
81
|
s.add_dependency(%q<rcov>, [">= 0"])
|
76
|
-
s.add_dependency(%q<
|
82
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
83
|
+
s.add_dependency(%q<rdoc>, ["~> 3.8.0"])
|
84
|
+
s.add_dependency(%q<bluecloth>, ["~> 2.1.0"])
|
77
85
|
end
|
78
86
|
end
|
79
87
|
|
@@ -52,24 +52,24 @@ describe OctocatHerder::Connection do
|
|
52
52
|
it 'raises an ArgumentError if given an OAuth2 Token and a user name and password' do
|
53
53
|
expect do
|
54
54
|
OctocatHerder::Connection.new :user_name => 'bob', :password => 'pass', :oauth2_token => 'token'
|
55
|
-
end.to raise_error(ArgumentError, 'Cannot provide both an OAuth2
|
55
|
+
end.to raise_error(ArgumentError, 'Cannot provide both an OAuth2 token, and a user name and password')
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'sets the Authorization header when given an OAuth2 Token' do
|
59
59
|
conn = OctocatHerder::Connection.new :oauth2_token => 'my_token'
|
60
60
|
|
61
|
-
conn.httparty_options.should == { :headers => { 'Authorization' => 'token my_token' } }
|
61
|
+
conn.send(:httparty_options).should == { :headers => { 'Authorization' => 'token my_token' } }
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'uses basic auth when given a user name and password' do
|
65
65
|
conn = OctocatHerder::Connection.new :user_name => 'user', :password => 'pass'
|
66
66
|
|
67
|
-
conn.httparty_options.should == { :basic_auth => { :username => 'user', :password => 'pass' } }
|
67
|
+
conn.send(:httparty_options).should == { :basic_auth => { :username => 'user', :password => 'pass' } }
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'should not set any additional options when making unauthenticated requests' do
|
71
71
|
conn = OctocatHerder::Connection.new
|
72
72
|
|
73
|
-
conn.httparty_options.should == {}
|
73
|
+
conn.send(:httparty_options).should == {}
|
74
74
|
end
|
75
75
|
end
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.2
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jacob Helwig
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-12 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -130,20 +130,52 @@ dependencies:
|
|
130
130
|
type: :development
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
132
|
prerelease: false
|
133
|
-
name:
|
133
|
+
name: yard
|
134
134
|
version_requirements: &id008 !ruby/object:Gem::Requirement
|
135
135
|
none: false
|
136
136
|
requirements:
|
137
|
-
- -
|
137
|
+
- - ~>
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
hash:
|
139
|
+
hash: 7
|
140
140
|
segments:
|
141
|
-
-
|
142
|
-
-
|
143
|
-
-
|
144
|
-
version:
|
141
|
+
- 0
|
142
|
+
- 6
|
143
|
+
- 0
|
144
|
+
version: 0.6.0
|
145
145
|
requirement: *id008
|
146
146
|
type: :development
|
147
|
+
- !ruby/object:Gem::Dependency
|
148
|
+
prerelease: false
|
149
|
+
name: rdoc
|
150
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
151
|
+
none: false
|
152
|
+
requirements:
|
153
|
+
- - ~>
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
hash: 39
|
156
|
+
segments:
|
157
|
+
- 3
|
158
|
+
- 8
|
159
|
+
- 0
|
160
|
+
version: 3.8.0
|
161
|
+
requirement: *id009
|
162
|
+
type: :development
|
163
|
+
- !ruby/object:Gem::Dependency
|
164
|
+
prerelease: false
|
165
|
+
name: bluecloth
|
166
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
167
|
+
none: false
|
168
|
+
requirements:
|
169
|
+
- - ~>
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
hash: 11
|
172
|
+
segments:
|
173
|
+
- 2
|
174
|
+
- 1
|
175
|
+
- 0
|
176
|
+
version: 2.1.0
|
177
|
+
requirement: *id010
|
178
|
+
type: :development
|
147
179
|
description: This gem provides Ruby bindings to the v3 GitHub API
|
148
180
|
email: jacob@technosorcery.net
|
149
181
|
executables: []
|
@@ -151,14 +183,16 @@ executables: []
|
|
151
183
|
extensions: []
|
152
184
|
|
153
185
|
extra_rdoc_files:
|
154
|
-
- LICENSE
|
155
|
-
- README.
|
186
|
+
- LICENSE
|
187
|
+
- README.markdown
|
156
188
|
files:
|
157
189
|
- .document
|
190
|
+
- .travis.yml
|
191
|
+
- CONTRIBUTING.markdown
|
158
192
|
- Gemfile
|
159
193
|
- Gemfile.lock
|
160
|
-
- LICENSE
|
161
|
-
- README.
|
194
|
+
- LICENSE
|
195
|
+
- README.markdown
|
162
196
|
- Rakefile
|
163
197
|
- VERSION
|
164
198
|
- lib/octocat_herder.rb
|
data/README.rdoc
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
= octocat_herder
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Contributing to octocat-herder
|
6
|
-
|
7
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
-
* Fork the project
|
10
|
-
* Start a feature/bugfix branch
|
11
|
-
* Commit and push until you are happy with your contribution
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2011 Jacob Helwig. See LICENSE.txt for
|
18
|
-
further details.
|
19
|
-
|