octokit 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -0
- data/CHANGELOG.md +2 -0
- data/README.md +4 -3
- data/lib/octokit/client/pub_sub_hubbub/service_hooks.rb +2 -2
- data/lib/octokit/configuration.rb +6 -0
- data/lib/octokit/connection.rb +2 -3
- data/lib/octokit/repository.rb +1 -1
- data/lib/octokit/version.rb +1 -1
- data/spec/octokit/client_spec.rb +19 -0
- data/spec/repository_spec.rb +1 -0
- metadata +26 -26
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
* [1.6.0 - June 14, 2012](https://github.com/pengwynn/octokit/compare/v1.5.0...v1.6.0)
|
4
|
+
* [1.5.0 - June 14, 2012](https://github.com/pengwynn/octokit/compare/v1.4.0...v1.5.0)
|
3
5
|
* [1.4.0 - June 3, 2012](https://github.com/pengwynn/octokit/compare/v1.3.0...v1.4.0)
|
4
6
|
* [1.3.0 - May 17, 2012](https://github.com/pengwynn/octokit/compare/v1.2.1...v1.3.0)
|
5
7
|
* [1.2.0 - May 17, 2012](https://github.com/pengwynn/octokit/compare/v1.1.1...v1.2.0)
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Octokit [![Build Status](https://secure.travis-ci.org/pengwynn/octokit.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/pengwynn/octokit.png?travis)][gemnasium]
|
2
|
-
Simple Ruby wrapper for the GitHub
|
2
|
+
Simple Ruby wrapper for the GitHub v3 API.
|
3
3
|
|
4
4
|
[travis]: http://travis-ci.org/pengwynn/octokit
|
5
5
|
[gemnasium]: https://gemnasium.com/pengwynn/octokit
|
@@ -26,7 +26,8 @@ Octokit.following("sferik")
|
|
26
26
|
```
|
27
27
|
|
28
28
|
### Repositories
|
29
|
-
For convenience, methods that require a repository argument may be passed in
|
29
|
+
For convenience, methods that require a repository argument may be passed in
|
30
|
+
any of the following forms:
|
30
31
|
|
31
32
|
* `"pengwynn/octokit"`
|
32
33
|
* `{:username => "pengwynn", :name => "octokit"}`
|
@@ -35,7 +36,7 @@ For convenience, methods that require a repository argument may be passed in any
|
|
35
36
|
|
36
37
|
```ruby
|
37
38
|
Octokit.repo("pengwynn/octokit")
|
38
|
-
=> <#Hashie::Rash created_at="2009/12/10 13:41:49 -0800" description="Simple Ruby wrapper for the GitHub
|
39
|
+
=> <#Hashie::Rash created_at="2009/12/10 13:41:49 -0800" description="Simple Ruby wrapper for the GitHub API and feeds" fork=false forks=25 has_downloads=true has_issues=true has_wiki=true homepage="http://wynnnetherland.com/projects/octokit" integrate_branch="master" language="Ruby" name="octokit" open_issues=8 owner="pengwynn" private=false pushed_at="2011/05/05 10:48:57 -0700" size=1804 url="https://github.com/pengwynn/octokit" watchers=92>
|
39
40
|
```
|
40
41
|
|
41
42
|
## Authenticated Requests
|
@@ -13,7 +13,7 @@ module Octokit
|
|
13
13
|
# client = Octokit::Client.new(:oauth_token = "token")
|
14
14
|
# client.subscribe_service_hook('joshk/device_imapable', 'Travis', { :token => "test", :domain => "domain", :user => "user" })
|
15
15
|
def subscribe_service_hook(repo, service_name, service_arguments = {})
|
16
|
-
topic = "
|
16
|
+
topic = "#{Octokit.web_endpoint}/#{Repository.new(repo)}/events/push"
|
17
17
|
callback = "github://#{service_name}?#{service_arguments.collect{ |k,v| [ k,v ].join("=") }.join("&") }"
|
18
18
|
subscribe(topic, callback)
|
19
19
|
true
|
@@ -28,7 +28,7 @@ module Octokit
|
|
28
28
|
# client = Octokit::Client.new(:oauth_token = "token")
|
29
29
|
# client.unsubscribe_service_hook('joshk/device_imapable', 'Travis')
|
30
30
|
def unsubscribe_service_hook(repo, service_name)
|
31
|
-
topic = "
|
31
|
+
topic = "#{Octokit.web_endpoint}/#{Repository.new(repo)}/events/push"
|
32
32
|
callback = "github://#{service_name}"
|
33
33
|
unsubscribe(topic, callback)
|
34
34
|
true
|
@@ -6,6 +6,8 @@ module Octokit
|
|
6
6
|
VALID_OPTIONS_KEYS = [
|
7
7
|
:adapter,
|
8
8
|
:api_version,
|
9
|
+
:api_endpoint,
|
10
|
+
:web_endpoint,
|
9
11
|
:login,
|
10
12
|
:password,
|
11
13
|
:proxy,
|
@@ -16,6 +18,8 @@ module Octokit
|
|
16
18
|
|
17
19
|
DEFAULT_ADAPTER = Faraday.default_adapter
|
18
20
|
DEFAULT_API_VERSION = 3
|
21
|
+
DEFAULT_API_ENDPOINT = 'https://api.github.com'
|
22
|
+
DEFAULT_WEB_ENDPOINT = 'https://github.com'
|
19
23
|
DEFAULT_USER_AGENT = "Octokit Ruby Gem #{Octokit::VERSION}".freeze
|
20
24
|
DEFAULT_AUTO_TRAVERSAL = false
|
21
25
|
|
@@ -36,6 +40,8 @@ module Octokit
|
|
36
40
|
def reset
|
37
41
|
self.adapter = DEFAULT_ADAPTER
|
38
42
|
self.api_version = DEFAULT_API_VERSION
|
43
|
+
self.api_endpoint = DEFAULT_API_ENDPOINT
|
44
|
+
self.web_endpoint = DEFAULT_WEB_ENDPOINT
|
39
45
|
self.login = nil
|
40
46
|
self.password = nil
|
41
47
|
self.proxy = nil
|
data/lib/octokit/connection.rb
CHANGED
@@ -8,10 +8,8 @@ module Octokit
|
|
8
8
|
|
9
9
|
def connection(authenticate=true, raw=false, version=3, force_urlencoded=false)
|
10
10
|
case version
|
11
|
-
when 2
|
12
|
-
url = "https://github.com"
|
13
11
|
when 3
|
14
|
-
url =
|
12
|
+
url = Octokit.api_endpoint
|
15
13
|
end
|
16
14
|
|
17
15
|
options = {
|
@@ -22,6 +20,7 @@ module Octokit
|
|
22
20
|
|
23
21
|
options.merge!(:params => {:access_token => oauth_token}) if oauthed? && !authenticated?
|
24
22
|
|
23
|
+
# TODO: Don't build on every request
|
25
24
|
connection = Faraday.new(options) do |builder|
|
26
25
|
if version >= 3 && !force_urlencoded
|
27
26
|
builder.request :json
|
data/lib/octokit/repository.rb
CHANGED
data/lib/octokit/version.rb
CHANGED
data/spec/octokit/client_spec.rb
CHANGED
@@ -62,4 +62,23 @@ describe Octokit::Client do
|
|
62
62
|
|
63
63
|
end
|
64
64
|
|
65
|
+
describe "api_endpoint" do
|
66
|
+
|
67
|
+
after(:each) do
|
68
|
+
Octokit.reset
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should default to https://api.github.com" do
|
72
|
+
client = Octokit::Client.new
|
73
|
+
client.api_endpoint.should == 'https://api.github.com'
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should be set " do
|
77
|
+
Octokit.api_endpoint = 'http://foo.dev'
|
78
|
+
client = Octokit::Client.new
|
79
|
+
client.api_endpoint.should == 'http://foo.dev'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
65
84
|
end
|
data/spec/repository_spec.rb
CHANGED
@@ -41,6 +41,7 @@ describe Octokit::Repository do
|
|
41
41
|
repository = Octokit::Repository.new(Octokit::Repository.new('sferik/octokit'))
|
42
42
|
repository.name.should == "octokit"
|
43
43
|
repository.username.should == "sferik"
|
44
|
+
repository.url.should == 'https://github.com/sferik/octokit'
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octokit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-06-
|
14
|
+
date: 2012-06-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: addressable
|
18
|
-
requirement: &
|
18
|
+
requirement: &70139666166520 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: '2.2'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70139666166520
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday
|
29
|
-
requirement: &
|
29
|
+
requirement: &70139666181720 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ~>
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: '0.8'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70139666181720
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: faraday_middleware
|
40
|
-
requirement: &
|
40
|
+
requirement: &70139666180560 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: '0.8'
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70139666180560
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: hashie
|
51
|
-
requirement: &
|
51
|
+
requirement: &70139666179420 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ~>
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: '1.2'
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *70139666179420
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: multi_json
|
62
|
-
requirement: &
|
62
|
+
requirement: &70139666178360 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ~>
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: '1.3'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *70139666178360
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: json
|
73
|
-
requirement: &
|
73
|
+
requirement: &70139666177760 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ! '>='
|
@@ -78,10 +78,10 @@ dependencies:
|
|
78
78
|
version: '0'
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *70139666177760
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: maruku
|
84
|
-
requirement: &
|
84
|
+
requirement: &70139666177020 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ! '>='
|
@@ -89,10 +89,10 @@ dependencies:
|
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
|
-
version_requirements: *
|
92
|
+
version_requirements: *70139666177020
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: rake
|
95
|
-
requirement: &
|
95
|
+
requirement: &70139666176160 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
98
98
|
- - ! '>='
|
@@ -100,10 +100,10 @@ dependencies:
|
|
100
100
|
version: '0'
|
101
101
|
type: :development
|
102
102
|
prerelease: false
|
103
|
-
version_requirements: *
|
103
|
+
version_requirements: *70139666176160
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: rspec
|
106
|
-
requirement: &
|
106
|
+
requirement: &70139666175160 !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
109
109
|
- - ! '>='
|
@@ -111,10 +111,10 @@ dependencies:
|
|
111
111
|
version: '0'
|
112
112
|
type: :development
|
113
113
|
prerelease: false
|
114
|
-
version_requirements: *
|
114
|
+
version_requirements: *70139666175160
|
115
115
|
- !ruby/object:Gem::Dependency
|
116
116
|
name: simplecov
|
117
|
-
requirement: &
|
117
|
+
requirement: &70139666190520 !ruby/object:Gem::Requirement
|
118
118
|
none: false
|
119
119
|
requirements:
|
120
120
|
- - ! '>='
|
@@ -122,10 +122,10 @@ dependencies:
|
|
122
122
|
version: '0'
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
|
-
version_requirements: *
|
125
|
+
version_requirements: *70139666190520
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: webmock
|
128
|
-
requirement: &
|
128
|
+
requirement: &70139666188600 !ruby/object:Gem::Requirement
|
129
129
|
none: false
|
130
130
|
requirements:
|
131
131
|
- - ! '>='
|
@@ -133,10 +133,10 @@ dependencies:
|
|
133
133
|
version: '0'
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
|
-
version_requirements: *
|
136
|
+
version_requirements: *70139666188600
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: yard
|
139
|
-
requirement: &
|
139
|
+
requirement: &70139666187960 !ruby/object:Gem::Requirement
|
140
140
|
none: false
|
141
141
|
requirements:
|
142
142
|
- - ! '>='
|
@@ -144,7 +144,7 @@ dependencies:
|
|
144
144
|
version: '0'
|
145
145
|
type: :development
|
146
146
|
prerelease: false
|
147
|
-
version_requirements: *
|
147
|
+
version_requirements: *70139666187960
|
148
148
|
description: Simple wrapper for the GitHub v3 API
|
149
149
|
email:
|
150
150
|
- wynn.netherland@gmail.com
|