git_hub_bub 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a831b1f3d872ae4e48c2bc73ed9e50237ae8c8b
4
- data.tar.gz: 32d3db1faf622bc54f5eaad2fe17ff977749e326
3
+ metadata.gz: 15aef8f8f4a8330bceb3f31c0f6c53f3ccfdd26a
4
+ data.tar.gz: 2d0d656b6f0edb4fb053a02dca39a06ee5601b54
5
5
  SHA512:
6
- metadata.gz: 0a90a9852e3ee0667579a58ea3a48dc70e70a85e397e4bd71dcb4295f58c117015bbbc4ce5c68b5ddfb9eaa107856b05faf3639296e0890bf183790259d0e51a
7
- data.tar.gz: 52bf1b48b14df6884f6266e8749f911d272672494d140d136edd8e906c582d3d162e4ac4410e84b6a363466a92cf954baf62bdf2ed97075b6cf94e90a12f37c0
6
+ metadata.gz: 75f78ad4c3c8860bcc27da3267c279feb14a36231acc60e5e3b5671b9edd69b84096fa4da15455536b6d4f64e1688845e0e8539e3f6a5a1c94aa848db36faf89
7
+ data.tar.gz: c2e68c03e123cb477dbec431b27585c0da96fce9fb6de52b37b6698a5c6077bc2ca168294ce22a29ffb533bf30d8334e8b28b2087b5dd3446b2d29cd80f88a12
data/.sample.env ADDED
@@ -0,0 +1,8 @@
1
+ GITHUB_API_KEY=asdfe92fakeKey43ad638e35asdfd98167847248a26
2
+ OWNER=schneems
3
+ REPO=wicked
4
+ USER_NAME="Richard Schneeman"
5
+ WATCH_OWNER=emberjs
6
+ WATCH_REPO=ember.js
7
+ GITHUB_APP_ID=1234foo
8
+ GITHUB_APP_SECRET=1234foosecret
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # GitHubBub
2
2
 
3
- [![Build Status](https://travis-ci.org/schneems/git_hub_bub.png?branch=master)](https://travis-ci.org/schneems/git_hub_bub)
3
+ [![Build Status](https://travis-ci.org/schneems/git_hub_bub.svg?branch=master)](https://travis-ci.org/schneems/git_hub_bub)
4
4
 
5
5
  A low level GitHub client that makes the disgusting issue of header based url pagination simple.
6
6
 
@@ -158,7 +158,7 @@ This gem is tested using the super cool request recording/stubbing framework [VC
158
158
  You'll also need a valid `.env` file
159
159
 
160
160
  ```sh
161
- $ touch .env
161
+ $ cp .sample.env .env
162
162
  ```
163
163
 
164
164
  Anything you put in this file will be sourced into your environment for tests. Here is an example `.env` file.
@@ -213,4 +213,4 @@ A repo that the `WATCH_OWNER` owns. Should be different from `REPO`
213
213
 
214
214
  ## License
215
215
 
216
- MIT
216
+ MIT
data/lib/git_hub_bub.rb CHANGED
@@ -11,6 +11,14 @@ require 'git_hub_bub/response'
11
11
 
12
12
  module GitHubBub
13
13
  class << self
14
+
15
+ def valid_token?(token)
16
+ Request.get("https://#{ENV['GITHUB_APP_ID']}:#{ENV['GITHUB_APP_SECRET']}@api.github.com/applications/#{ENV['GITHUB_APP_ID']}/tokens/#{token}", {}, token: nil)
17
+ true
18
+ rescue GitHubBub::RequestError
19
+ false
20
+ end
21
+
14
22
  def head(*args)
15
23
  Request.head(*args)
16
24
  end
@@ -12,7 +12,7 @@ module GitHubBub
12
12
  RETRIES = 1
13
13
 
14
14
  def initialize(url, query = {}, options = {})
15
- self.url = url.include?("http") ? url : File.join(BASE_URI, url)
15
+ self.url = url =~ /^http(\w?)\:\/\// ? url : File.join(BASE_URI, url)
16
16
  self.options = BASE_OPTIONS.merge(options || {})
17
17
  self.options[:query] = query if query && !query.empty?
18
18
  self.options[:headers] = BASE_HEADERS.merge(options[:headers]|| {})
@@ -1,3 +1,3 @@
1
1
  module GitHubBub
2
- VERSION = "0.0.2"
3
- end
2
+ VERSION = "0.0.3"
3
+ end
@@ -6,6 +6,18 @@ class RequestTest < Test::Unit::TestCase
6
6
  GitHubBub::Request.clear_callbacks
7
7
  end
8
8
 
9
+ def test_set_url
10
+ request = GitHubBub::Request.new('foo')
11
+ assert_equal "https://api.github.com/foo", request.url
12
+ request = GitHubBub::Request.new('http://foo.com')
13
+ assert_equal "http://foo.com", request.url
14
+ request = GitHubBub::Request.new('https://bar.com')
15
+ assert_equal "https://bar.com", request.url
16
+ request = GitHubBub::Request.new('arthurnn/http')
17
+ assert_equal "https://api.github.com/arthurnn/http", request.url
18
+ request = GitHubBub::Request.new('arthurnn/https')
19
+ assert_equal "https://api.github.com/arthurnn/https", request.url
20
+ end
9
21
 
10
22
  def test_set_callback
11
23
  request = GitHubBub::Request.new('foo')
data/test/test_helper.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  Bundler.require
2
2
 
3
+ require 'dotenv'
4
+ Dotenv.load
3
5
 
4
6
  require 'git_hub_bub'
5
7
  require 'test/unit'
@@ -28,11 +30,10 @@ VCR.configure do |c|
28
30
  c.cassette_library_dir = 'test/fixtures/vcr_cassettes'
29
31
  c.hook_into :webmock # or :fakeweb
30
32
 
31
- 'GITHUB_API_KEY OWNER REPO USER_NAME WATCH_OWNER WATCH_REPO'.split(' ').each do |secure|
33
+ 'GITHUB_API_KEY OWNER REPO USER_NAME WATCH_OWNER WATCH_REPO GITHUB_APP_ID GITHUB_APP_SECRET'.split(' ').each do |secure|
32
34
  sensitive = ENV[secure] ||= secure
33
35
  c.filter_sensitive_data("<#{secure}>") { sensitive }
34
36
  end
35
37
  end
36
38
 
37
- require 'dotenv'
38
- Dotenv.load
39
+
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_hub_bub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Schneeman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-16 00:00:00.000000000 Z
11
+ date: 2014-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rrrretry
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: excon
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: vcr
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 2.5.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.5.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 1.11.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.11.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: dotenv
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: git_hub_bub makes github requests
@@ -101,8 +101,9 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .gitignore
105
- - .travis.yml
104
+ - ".gitignore"
105
+ - ".sample.env"
106
+ - ".travis.yml"
106
107
  - Gemfile
107
108
  - README.md
108
109
  - Rakefile
@@ -132,17 +133,17 @@ require_paths:
132
133
  - lib
133
134
  required_ruby_version: !ruby/object:Gem::Requirement
134
135
  requirements:
135
- - - '>='
136
+ - - ">="
136
137
  - !ruby/object:Gem::Version
137
138
  version: '0'
138
139
  required_rubygems_version: !ruby/object:Gem::Requirement
139
140
  requirements:
140
- - - '>='
141
+ - - ">="
141
142
  - !ruby/object:Gem::Version
142
143
  version: '0'
143
144
  requirements: []
144
145
  rubyforge_project:
145
- rubygems_version: 2.0.3
146
+ rubygems_version: 2.2.0
146
147
  signing_key:
147
148
  specification_version: 4
148
149
  summary: git_hub_bub makes github requests