githubris 0.0.4 → 0.0.5

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.
Files changed (70) hide show
  1. data/.travis.yml +8 -2
  2. data/Gemfile +6 -3
  3. data/README.md +14 -0
  4. data/Rakefile +5 -11
  5. data/githubris.gemspec +2 -0
  6. data/lib/githubris.rb +18 -8
  7. data/lib/githubris/api.rb +89 -11
  8. data/lib/githubris/api/gist.rb +34 -15
  9. data/lib/githubris/api/http.rb +12 -0
  10. data/lib/githubris/api/user.rb +10 -4
  11. data/lib/githubris/base.rb +80 -0
  12. data/lib/githubris/comment.rb +1 -6
  13. data/lib/githubris/error.rb +5 -0
  14. data/lib/githubris/gist.rb +15 -60
  15. data/lib/githubris/gist/file.rb +1 -8
  16. data/lib/githubris/oauth.rb +36 -0
  17. data/lib/githubris/publicity.rb +13 -0
  18. data/lib/githubris/user.rb +13 -28
  19. data/lib/githubris/version.rb +1 -1
  20. data/spec/githubris/api/gist_spec.rb +8 -41
  21. data/spec/githubris/api/user_spec.rb +17 -2
  22. data/spec/githubris/api_spec.rb +99 -0
  23. data/spec/githubris/base_spec.rb +77 -0
  24. data/spec/githubris/gist_spec.rb +21 -76
  25. data/spec/githubris/oauth_spec.rb +71 -0
  26. data/spec/githubris/publicity_spec.rb +22 -0
  27. data/spec/githubris/user_spec.rb +50 -13
  28. data/spec/githubris_spec.rb +34 -40
  29. data/spec/spec_helper.rb +9 -6
  30. data/spec/support/fixtures.rb +115 -99
  31. data/spec/support/fixtures/vcr_cassettes/Githubris/_find_gist.yml +44 -0
  32. data/spec/support/fixtures/vcr_cassettes/Githubris/_find_user.yml +40 -0
  33. data/spec/support/fixtures/vcr_cassettes/Githubris/_public_gists.yml +55 -0
  34. data/spec/support/fixtures/vcr_cassettes/Githubris_API/_authenticated_/when_authenticated_with_bad_credentials.yml +40 -0
  35. data/spec/support/fixtures/vcr_cassettes/Githubris_API/_authenticated_/when_authenticated_with_good_credentials.yml +42 -0
  36. data/spec/support/fixtures/vcr_cassettes/Githubris_API/_authenticated_/when_there_are_no_credentials.yml +42 -0
  37. data/spec/support/fixtures/vcr_cassettes/Githubris_API_Gist/_get_gist.yml +44 -0
  38. data/spec/support/fixtures/vcr_cassettes/Githubris_API_Gist/_get_public_gists.yml +107 -0
  39. data/spec/support/fixtures/vcr_cassettes/Githubris_API_Gist/_get_user_gists.yml +43 -0
  40. data/spec/support/fixtures/vcr_cassettes/Githubris_API_User/_get_authenticated_user/without_credentials.yml +42 -0
  41. data/spec/support/fixtures/vcr_cassettes/Githubris_API_User/_get_user.yml +40 -0
  42. data/spec/support/fixtures/vcr_cassettes/Githubris_Gist/_save.yml +42 -0
  43. data/spec/support/fixtures/vcr_cassettes/Githubris_Gist/any_gist.yml +44 -0
  44. data/spec/support/fixtures/vcr_cassettes/Githubris_Gist/given_a_gist_full_of_data.yml +44 -0
  45. data/spec/support/fixtures/vcr_cassettes/Githubris_Gist/on_a_gist_with_an_id.yml +44 -0
  46. data/spec/support/fixtures/vcr_cassettes/Githubris_Gist/on_a_gist_with_an_id/_reload.yml +44 -0
  47. data/spec/support/fixtures/vcr_cassettes/Githubris_User/_gists.yml +43 -0
  48. data/spec/support/fixtures/vcr_cassettes/Githubris_User/_reload.yml +40 -0
  49. data/spec/support/fixtures/vcr_cassettes/Githubris_User/_reload/on_a_user_with_a_login.yml +40 -0
  50. data/spec/support/fixtures/vcr_cassettes/Githubris_User/_reload/on_a_user_without_a_login.yml +40 -0
  51. data/spec/support/fixtures/vcr_cassettes/Githubris_User/_starred_gists/on_an_authenticated_user.yml +82 -0
  52. data/spec/support/vcr.rb +6 -0
  53. metadata +57 -21
  54. data/features/get_a_gist.feature +0 -13
  55. data/features/get_a_user.feature +0 -8
  56. data/features/list_of_public_gists.feature +0 -12
  57. data/features/list_of_users_public_gists.feature +0 -13
  58. data/features/step_definitions/general_steps.rb +0 -32
  59. data/features/support/env.rb +0 -6
  60. data/features/support/fakeweb_responses.rb +0 -12
  61. data/features/support/fixtures.rb +0 -47
  62. data/lib/githubris/builder.rb +0 -28
  63. data/spec/githubris/builder_spec.rb +0 -28
  64. data/spec/support/custom_matchers.rb +0 -27
  65. data/spec/support/fakeweb_responses.rb +0 -12
  66. data/spec/support/gist.json +0 -335
  67. data/spec/support/public_gists_page_1.json +0 -884
  68. data/spec/support/public_gists_page_2.json +0 -898
  69. data/spec/support/user.json +0 -14
  70. data/spec/support/user_public_gists.json +0 -65
@@ -1,92 +1,37 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Githubris::Gist do
4
+ let(:id) { 1 }
5
+ subject { described_class.new :id => id }
4
6
 
5
- context 'when passed a specific gist' do
6
- subject { Githubris::Gist.new gist_attributes }
7
- let(:gist_attributes) { Githubris::Builder.new.build gist_data }
8
- let(:gist_data) { Githubris::SpecHelper.gist_data }
7
+ context 'on a gist with an id' do
8
+ use_vcr_cassette
9
9
 
10
-
11
- it 'is public' do
12
- subject.should be_public
13
- end
14
-
15
- its(:id) { should eql 1 }
16
-
17
- its(:description) { should eql 'the meaning of gist' }
18
-
19
- it 'was created at 6:17:13 on July 15, 2008' do
20
- subject.created_at.should eql DateTime.new(2008, 7, 15, 18, 17, 13)
21
- end
22
-
23
- it 'was updated at 2:58:22 on Feburary 22, 2011' do
24
- subject.updated_at.should eql DateTime.new(2011, 2, 22, 2, 58, 22)
25
- end
26
-
27
- its(:url) { should be_kind_of URI }
28
- its(:id) { should be_instance_of Fixnum }
29
- its(:description) { should be_instance_of String }
30
- it { should be_public }
31
- its(:created_at) { should be_instance_of DateTime }
32
- its(:updated_at) { should be_instance_of DateTime }
33
- its(:comments) { should be_instance_of Array }
34
- its(:files) { should be_instance_of Array }
35
-
36
- end
37
-
38
- it 'new gists are created now' do
39
- DateTime.stub(:now => DateTime.new(2012))
40
- subject.created_at.should eql DateTime.now
41
- end
42
-
43
- context 'Gist owned by Isaac' do
44
- subject { Githubris::Gist.new :user => user }
45
- let(:user) { Githubris::User.new }
46
- its(:user) { should eql user }
47
- end
48
-
49
- describe 'a gist without files' do
50
- subject { Githubris::Gist.new }
51
- its(:files) { should be_empty }
52
- end
53
-
54
- describe 'a gist created with a file' do
55
- subject do
56
- Githubris::Gist.new(:files => {:stub => stub})
57
- end
58
-
59
- its(:files) { should have(1).items }
60
- end
61
-
62
- describe '#==' do
63
- it 'checks the attributes of each object' do
64
- subject.should == Githubris::Gist.new
65
- subject.should_not == stub
10
+ describe '#reload' do
11
+ it 'returns the same object' do
12
+ obj_id = subject.object_id
13
+ subject.reload.object_id.should == obj_id
14
+ end
66
15
  end
67
16
  end
68
17
 
69
- describe '#reload' do
18
+ context 'given a gist full of data' do
19
+ use_vcr_cassette
70
20
 
71
- it 'errors without an id' do
72
- lambda do
21
+ describe '#user' do
22
+ it 'returns a user' do
73
23
  subject.reload
74
- end.should raise_error
24
+ subject.user.should be_instance_of Githubris::User
25
+ end
75
26
  end
27
+ end
76
28
 
77
- context 'on a gist with an id' do
78
- subject { Githubris::Gist.new :id => id }
79
- let(:id) { 1 }
80
-
81
- it 'hits the API' do
82
- Githubris::API.any_instance.should_receive(:get_gist).with(id)
83
- subject.reload
84
- end
29
+ describe '#save' do
30
+ use_vcr_cassette
85
31
 
86
- it 'returns the same object' do
87
- obj_id = subject.object_id
88
- subject.reload.object_id.should == obj_id
89
- end
32
+ it 'it must have be public or not, and it must have files' do
33
+ gist = described_class.new :public => true, :files => {'gistfile.txt' => {:content => 'foobar'}}
34
+ lambda { gist.save }.should_not raise_error
90
35
  end
91
36
  end
92
37
  end
@@ -0,0 +1,71 @@
1
+ require 'spec_helper'
2
+
3
+ describe Githubris::OAuth do
4
+ let(:oauth) { described_class.new(client_id, client_secret) }
5
+ let(:client_id) { 'client_id' }
6
+ let(:client_secret) { 'client_secret' }
7
+
8
+ before do
9
+ access_token_response =<<-RESPONSE
10
+ HTTP/1.1 200 OK
11
+ Server: nginx/1.0.13
12
+ Date: Wed, 21 Mar 2012 12:54:41 GMT
13
+ Content-Type: application/x-www-form-urlencoded; charset=utf-8
14
+ Connection: keep-alive
15
+ Status: 200 OK
16
+ ETag: "fa6a87d35864200004d1eff50d685301"
17
+ X-Frame-Options: deny
18
+ X-Runtime: 14
19
+ Content-Length: 71
20
+ Cache-Control: private, max-age=0, must-revalidate
21
+ Strict-Transport-Security: max-age=2592000
22
+
23
+ access_token=ACCESSCODE&token_type=bearer
24
+ RESPONSE
25
+ FakeWeb.register_uri(:post, /github.com\/login\/oauth\/access_token/, :response => access_token_response)
26
+ end
27
+
28
+ after do
29
+ FakeWeb.clean_registry
30
+ end
31
+
32
+ describe '#initialize' do
33
+ it 'requires a client_id and a client_secret' do
34
+ lambda do
35
+ described_class.new(client_id, client_secret)
36
+ end.should_not raise_error
37
+ end
38
+ end
39
+
40
+ describe '#request_access_url' do
41
+ subject { oauth.request_access_url }
42
+ let(:request_access_url_pattern) do
43
+ /https:\/\/github.com\/login\/oauth\/authorize\?.*client_id=#{client_id}/
44
+ end
45
+
46
+ it { should match request_access_url_pattern }
47
+
48
+ it 'takes a list of scopes and a redirect_uri, optionally' do
49
+ redirect_uri = 'https://isaacbfsanders.com'
50
+ url = oauth.request_access_url(:scopes => [:user, :public_repo, :repo, :gist],
51
+ :redirect_uri => redirect_uri)
52
+ url.should match request_access_url_pattern
53
+ url.should match /scopes=user,public_repo,repo,gist/
54
+ url.should match /redirect_uri=#{URI.encode(redirect_uri)}/
55
+ end
56
+ end
57
+
58
+ describe '#access_token' do
59
+ use_vcr_cassette
60
+
61
+ it 'requires a code parameter' do
62
+ lambda do
63
+ oauth.access_token('code')
64
+ end.should_not raise_error
65
+ end
66
+
67
+ it 'returns a string' do
68
+ oauth.access_token('code').should be_kind_of String
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,22 @@
1
+
2
+ describe Githubris::Publicity do
3
+ subject do
4
+ Githubris::Base.new(:public => true).extend Githubris::Publicity
5
+ end
6
+
7
+ it { should be_public }
8
+
9
+ describe '#publicize' do
10
+ it 'makes the gist public' do
11
+ subject.publicize
12
+ subject.should be_public
13
+ end
14
+ end
15
+
16
+ describe '#privatize' do
17
+ it 'makes the gist private' do
18
+ subject.privatize
19
+ subject.should_not be_public
20
+ end
21
+ end
22
+ end
@@ -1,24 +1,61 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Githubris::User do
4
- it 'is initialized with an attributes hash' do
5
- attributes = {foo: 'bar'}
6
- lambda { Githubris::User.new attributes }.should_not raise_error
4
+ describe '#gists' do
5
+ use_vcr_cassette
6
+
7
+ it 'gets a list of gists' do
8
+ gists = described_class.new(:login => 'GithubrisTestUser').gists
9
+ gists.each do |gist|
10
+ gist.should be_instance_of Githubris::Gist
11
+ end
12
+ end
7
13
  end
8
14
 
9
- describe '#public_gists' do
10
- it 'hits the API' do
11
- Githubris::API.any_instance.should_receive(:get_user_public_gists)
12
- user = Githubris::User.new
13
- user.public_gists
15
+ describe '#starred_gists' do
16
+
17
+ context 'on an authenticated user' do
18
+
19
+ subject do
20
+ ghr = Githubris.new
21
+ ghr.basic_auth 'GithubrisTestUser', 'password'
22
+ VCR.use_cassette 'Githubris_API/_authenticated_/when_authenticated_with_good_credentials' do
23
+ ghr.authenticated_user
24
+ end
25
+ end
26
+
27
+ use_vcr_cassette
28
+
29
+ it 'returns a list of starred gists' do
30
+ subject.starred_gists.each do |gist|
31
+ gist.should be_instance_of Githubris::Gist
32
+ end
33
+ end
14
34
  end
15
35
  end
16
36
 
17
- describe '#==' do
18
- it 'matches based on attributes' do
19
- user1 = Githubris::User.new({foo: 'bar'})
20
- user2 = Githubris::User.new({foo: 'bar'})
21
- user1.should == user2
37
+ describe '#reload' do
38
+
39
+ context 'on a user with a login' do
40
+ use_vcr_cassette
41
+
42
+ subject { described_class.new :login => login }
43
+ let(:login) { 'GithubrisTestUser' }
44
+
45
+ it 'returns the same object' do
46
+ obj_id = subject.object_id
47
+ subject.reload.object_id.should == obj_id
48
+ end
49
+ end
50
+
51
+ context 'on a user without a login' do
52
+ use_vcr_cassette
53
+
54
+ it 'raises an error' do
55
+ lambda do
56
+ subject.reload
57
+ end.should raise_error Githubris::Error::NotFound
58
+ end
22
59
  end
23
60
  end
24
61
  end
@@ -1,78 +1,72 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Githubris do
4
- describe '#authenticate' do
5
- before do
6
- Githubris::API.stub(:basic_auth => Githubris::User.new)
7
- subject.authenticate('username', 'password')
4
+ describe '#basic_auth' do
5
+ let(:password) { 'password' }
6
+
7
+ context 'with valid credentials' do
8
+ let(:username) { 'GithubrisTestUser' }
9
+
10
+ it 'authenticates via the API' do
11
+ Githubris::API.any_instance.should_receive(:basic_auth).with(username, password)
12
+ subject.basic_auth(username, password)
13
+ end
8
14
  end
15
+ end
16
+
17
+ describe '#oauth' do
18
+ let(:client_id) { 'client_id' }
19
+ let(:client_secret) { 'client_secret' }
9
20
 
10
- it 'authenticates via Basic Auth' do
11
- Githubris::API.should have_received(:basic_auth).with('username', 'password')
21
+ it 'creates an Githubris::OAuth object' do
22
+ subject.oauth(client_id, client_secret).should be_instance_of Githubris::OAuth
12
23
  end
24
+ end
13
25
 
14
- it 'sets the authenticated user' do
15
- subject.authenticated_user.should_not be_nil
26
+ describe '#authenticated?' do
27
+ it 'delegates to the API' do
28
+ Githubris::API.any_instance.should_receive :authenticated?
29
+ subject.authenticated?
16
30
  end
17
31
  end
18
32
 
19
33
  describe '#find_user' do
34
+ use_vcr_cassette
35
+
20
36
  it 'requests gets user from githubris api' do
21
- user = Githubris::User.new(:login => "frank")
37
+ user = Githubris::User.new(:login => 'GithubrisTestUser')
22
38
  Githubris::API.any_instance.stub(:get_user).and_return(user)
23
- subject.find_user("frank").should == user
39
+ subject.find_user('GithubrisTestUser').should == user
24
40
  end
25
41
 
26
42
  it 'returns a user' do
27
- subject.find_user('frank').should be_instance_of Githubris::User
43
+ subject.find_user('GithubrisTestUser').should be_instance_of Githubris::User
28
44
  end
29
45
  end
30
46
 
31
47
  describe '#public_gists' do
48
+ use_vcr_cassette
49
+
32
50
  it 'should contain only gists' do
33
51
  subject.public_gists.each do |gist|
34
52
  gist.should be_instance_of Githubris::Gist
35
53
  end
36
54
  end
37
55
 
38
- it 'can take an options hash' do
39
- lambda { subject.public_gists(:foo => 'bar') }.should_not raise_error
40
- end
41
-
42
56
  it 'delegates and passes the options hash to the API' do
43
57
  Githubris::API.any_instance.stub(:get_public_gists)
44
58
  subject.public_gists({:foo => 'bar'})
45
- subject.instance_variable_get(:@api).should have_received(:get_public_gists).with({foo: 'bar'})
59
+ subject.instance_variable_get(:@api).should have_received(:get_public_gists).with({:foo => 'bar'})
46
60
  end
47
61
  end
48
62
 
49
63
  describe '#find_gist' do
50
64
  let(:id) { 1 }
65
+ subject { Githubris.new.find_gist(id) }
66
+ use_vcr_cassette
51
67
 
52
- it 'takes a gist\'s id' do
53
- lambda do
54
- subject.find_gist(id)
55
- end.should_not raise_error
56
- end
57
-
58
- it 'hits the API' do
59
- Githubris::API.any_instance.should_receive(:get_gist).with(id)
60
- subject.find_gist(id)
61
- end
62
-
63
- context 'the gist it returns' do
64
- subject { Githubris.new.find_gist(id) }
65
-
66
- it 'has the same id that was passed in' do
67
- subject.should be_instance_of Githubris::Gist
68
- subject.id.should == id
69
- end
70
-
71
- it 'has a user' do
72
- lambda do
73
- subject.user.should be_instance_of Githubris::User
74
- end.should_not raise_error
75
- end
68
+ it 'returns a gist' do
69
+ subject.should be_instance_of Githubris::Gist
76
70
  end
77
71
  end
78
72
  end
@@ -1,15 +1,18 @@
1
1
  require 'rspec-spies'
2
- require 'fakeweb'
3
- require 'simplecov'
4
2
  require 'githubris'
3
+ require 'simplecov'
4
+ require 'fakeweb'
5
+ require 'pry'
5
6
 
6
7
  require 'support/fixtures'
7
- require 'support/fakeweb_responses'
8
- require 'support/custom_matchers'
8
+ require 'support/vcr'
9
+
10
+ RSpec.configure do |config|
11
+ config.extend VCR::RSpec::Macros
12
+ end
9
13
 
10
14
  SimpleCov.start do
11
15
  add_filter '/spec/'
12
- add_filter '/features/'
13
16
  add_filter '/pkg/'
14
17
  add_filter '/coverage/'
15
- end
18
+ end if ENV['COVERAGE']
@@ -1,112 +1,128 @@
1
- class Githubris
2
- module SpecHelper
3
- def self.gist_collection_data
4
- [
5
- {
6
- "created_at" => "2008-07-20T22:54:53Z",
7
- "git_push_url" => "git@gist.github.com:36.git",
8
- "user" => {
9
- "avatar_url" => "https://secure.gravatar.com/avatar/fcafc7eab67d34d48b14f9d70bc05713?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
10
- "url" => "https://api.github.com/users/adamwiggins",
11
- "gravatar_id" => "fcafc7eab67d34d48b14f9d70bc05713",
12
- "id" => 177,
13
- "login" => "adamwiggins"
14
- },
15
- "public" => true,
16
- "url" => "https://api.github.com/gists/36",
17
- "description" => nil,
18
- "updated_at" => "2009-10-14T10:23:21Z",
19
- "comments" => 0,
20
- "files" => {
21
- "gistfile1.diff" => {
22
- "type" => "text/plain",
23
- "filename" => "gistfile1.diff",
24
- "language" => "Diff",
25
- "raw_url" => "https://gist.github.com/raw/36/588da740399b34cf9ab649c5198954aadc6e36ff/gistfile1.diff",
26
- "size" => 5467
27
- }
28
- },
29
- "id" => "36",
30
- "html_url" => "https://gist.github.com/36",
31
- "git_pull_url" => "git://gist.github.com/36.git"
1
+ class Githubris::SpecHelper
2
+ def self.gist_collection_data
3
+ [
4
+ {
5
+ "created_at" => "2008-07-20T22:54:53Z",
6
+ "git_push_url" => "git@gist.github.com:36.git",
7
+ "user" => {
8
+ "avatar_url" => "https://secure.gravatar.com/avatar/fcafc7eab67d34d48b14f9d70bc05713?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
9
+ "url" => "https://api.github.com/users/adamwiggins",
10
+ "gravatar_id" => "fcafc7eab67d34d48b14f9d70bc05713",
11
+ "id" => 177,
12
+ "login" => "adamwiggins"
32
13
  },
33
- {
34
- "created_at" => "2008-07-17T09:01:22Z",
35
- "git_push_url" => "git@gist.github.com:10.git",
36
- "user" => {
37
- "avatar_url" => "https://secure.gravatar.com/avatar/b8dbb1987e8e5318584865f880036796?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
38
- "url" => "https://api.github.com/users/defunkt",
39
- "gravatar_id" => "b8dbb1987e8e5318584865f880036796",
40
- "id" => 2,
41
- "login" => "defunkt"
42
- },
43
- "public" => true,
44
- "url" => "https://api.github.com/gists/10",
45
- "description" => "asd",
46
- "updated_at" => "2009-10-14T10:23:15Z",
47
- "comments" => 0,
48
- "files" => {
49
- "Imp_pomocu_pokazivaca" => {
50
- "type" => "text/plain",
51
- "filename" => "Imp_pomocu_pokazivaca",
52
- "language" => nil,
53
- "raw_url" => "https://gist.github.com/raw/10/ce5e83b3d8ed83c5a950f116e07505dfd2cb608a/Imp_pomocu_pokazivaca",
54
- "size" => 1347
55
- }
56
- },
57
- "id" => "10",
58
- "html_url" => "https://gist.github.com/10",
59
- "git_pull_url" => "git://gist.github.com/10.git"
60
- }
61
- ]
62
- end
63
-
64
- def self.gist_data
14
+ "public" => true,
15
+ "url" => "https://api.github.com/gists/36",
16
+ "description" => nil,
17
+ "updated_at" => "2009-10-14T10:23:21Z",
18
+ "comments" => 0,
19
+ "files" => {
20
+ "gistfile1.diff" => {
21
+ "type" => "text/plain",
22
+ "filename" => "gistfile1.diff",
23
+ "language" => "Diff",
24
+ "raw_url" => "https://gist.github.com/raw/36/588da740399b34cf9ab649c5198954aadc6e36ff/gistfile1.diff",
25
+ "size" => 5467
26
+ }
27
+ },
28
+ "id" => "36",
29
+ "html_url" => "https://gist.github.com/36",
30
+ "git_pull_url" => "git://gist.github.com/36.git"
31
+ },
65
32
  {
66
- "created_at" => "2008-07-15T18:17:13Z",
67
- "git_push_url" => "git@gist.github.com:1.git",
33
+ "created_at" => "2008-07-17T09:01:22Z",
34
+ "git_push_url" => "git@gist.github.com:10.git",
68
35
  "user" => {
69
- "avatar_url" => "https://secure.gravatar.com/avatar/9375a9529679f1b42b567a640d775e7d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
70
- "url" => "https://api.github.com/users/schacon",
71
- "gravatar_id" => "9375a9529679f1b42b567a640d775e7d",
72
- "id" => 70,
73
- "login" => "schacon"
36
+ "avatar_url" => "https://secure.gravatar.com/avatar/b8dbb1987e8e5318584865f880036796?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
37
+ "url" => "https://api.github.com/users/defunkt",
38
+ "gravatar_id" => "b8dbb1987e8e5318584865f880036796",
39
+ "id" => 2,
40
+ "login" => "defunkt"
74
41
  },
75
42
  "public" => true,
76
- "url" => "https://api.github.com/gists/1",
77
- "description" => "the meaning of gist",
78
- "updated_at" => "2011-02-22T02:58:22Z",
79
- "comments" => 5,
43
+ "url" => "https://api.github.com/gists/10",
44
+ "description" => "asd",
45
+ "updated_at" => "2009-10-14T10:23:15Z",
46
+ "comments" => 0,
80
47
  "files" => {
81
- "gistfile1.txt" => {
48
+ "Imp_pomocu_pokazivaca" => {
82
49
  "type" => "text/plain",
83
- "filename" => "gistfile1.txt",
84
- "language" => "Text",
85
- "raw_url" => "https://gist.github.com/raw/1/9b2ac7c792209f19e157ddaf00f8946edc306a6b/gistfile1.txt",
86
- "size" => 178
50
+ "filename" => "Imp_pomocu_pokazivaca",
51
+ "language" => nil,
52
+ "raw_url" => "https://gist.github.com/raw/10/ce5e83b3d8ed83c5a950f116e07505dfd2cb608a/Imp_pomocu_pokazivaca",
53
+ "size" => 1347
87
54
  }
88
55
  },
89
- "id" => "1",
90
- "html_url" => "https://gist.github.com/1",
91
- "git_pull_url" => "git://gist.github.com/1.git"
56
+ "id" => "10",
57
+ "html_url" => "https://gist.github.com/10",
58
+ "git_pull_url" => "git://gist.github.com/10.git"
92
59
  }
93
- end
60
+ ]
61
+ end
94
62
 
95
- def self.user_data
96
- {
97
- "public_gists" => 2,
98
- "type" => "User",
99
- "following" => 0,
100
- "login" => "GithubrisTestUser",
101
- "avatar_url" => "https://secure.gravatar.com/avatar/20de3fd01e285d14de84067c34ab74d2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
102
- "public_repos" => 1,
103
- "followers" => 0,
104
- "html_url" => "https://github.com/GithubrisTestUser",
105
- "url" => "https://api.github.com/users/GithubrisTestUser",
106
- "created_at" => "2012-02-24T12:23:28Z",
107
- "gravatar_id" => "20de3fd01e285d14de84067c34ab74d2",
108
- "id" => 1469392
109
- }
110
- end
63
+ def self.gist_data
64
+ {
65
+ "created_at" => "2008-07-15T18:17:13Z",
66
+ "git_push_url" => "git@gist.github.com:1.git",
67
+ "user" => {
68
+ "avatar_url" => "https://secure.gravatar.com/avatar/9375a9529679f1b42b567a640d775e7d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
69
+ "url" => "https://api.github.com/users/schacon",
70
+ "gravatar_id" => "9375a9529679f1b42b567a640d775e7d",
71
+ "id" => 70,
72
+ "login" => "schacon"
73
+ },
74
+ "public" => true,
75
+ "url" => "https://api.github.com/gists/1",
76
+ "description" => "the meaning of gist",
77
+ "updated_at" => "2011-02-22T02:58:22Z",
78
+ "comments" => 5,
79
+ "files" => {
80
+ "gistfile1.txt" => {
81
+ "type" => "text/plain",
82
+ "filename" => "gistfile1.txt",
83
+ "language" => "Text",
84
+ "raw_url" => "https://gist.github.com/raw/1/9b2ac7c792209f19e157ddaf00f8946edc306a6b/gistfile1.txt",
85
+ "size" => 178
86
+ }
87
+ },
88
+ "id" => "1",
89
+ "html_url" => "https://gist.github.com/1",
90
+ "git_pull_url" => "git://gist.github.com/1.git"
91
+ }
92
+ end
93
+
94
+ def self.user_data
95
+ {
96
+ "public_gists" => 2,
97
+ "type" => "User",
98
+ "following" => 0,
99
+ "login" => "GithubrisTestUser",
100
+ "avatar_url" => "https://secure.gravatar.com/avatar/20de3fd01e285d14de84067c34ab74d2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
101
+ "public_repos" => 1,
102
+ "followers" => 0,
103
+ "html_url" => "https://github.com/GithubrisTestUser",
104
+ "url" => "https://api.github.com/users/GithubrisTestUser",
105
+ "created_at" => "2012-02-24T12:23:28Z",
106
+ "gravatar_id" => "20de3fd01e285d14de84067c34ab74d2",
107
+ "id" => 1469392
108
+ }
109
+ end
110
+
111
+ def self.not_found_error_data
112
+ {
113
+ "message" => "Not Found"
114
+ }
115
+ end
116
+
117
+ def self.bad_credentials_error_data
118
+ {
119
+ "message" => "Bad credentials"
120
+ }
121
+ end
122
+
123
+ def self.requires_authentication_error_data
124
+ {
125
+ "message" => "Requires authentication"
126
+ }
111
127
  end
112
128
  end