Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rename to Octokit

Closes #8.
  • Loading branch information...
commit f46bf3344fd2888b7083349782a5ab113c91f2ee 1 parent 879aee3
@sferik sferik authored
Showing with 205 additions and 204 deletions.
  1. +1 −1  LICENSE
  2. +39 −38 README.markdown
  3. +9 −9 lib/faraday/raise_error.rb
  4. +7 −7 lib/{octopussy.rb → octokit.rb}
  5. +30 −0 lib/octokit/client.rb
  6. +1 −1  lib/{octopussy → octokit}/client/authentication.rb
  7. +1 −1  lib/{octopussy → octokit}/client/commits.rb
  8. +1 −1  lib/{octopussy → octokit}/client/connection.rb
  9. +1 −1  lib/{octopussy → octokit}/client/issues.rb
  10. +1 −1  lib/{octopussy → octokit}/client/network.rb
  11. +1 −1  lib/{octopussy → octokit}/client/objects.rb
  12. +1 −1  lib/{octopussy → octokit}/client/organizations.rb
  13. +1 −1  lib/{octopussy → octokit}/client/pulls.rb
  14. +1 −1  lib/{octopussy → octokit}/client/repositories.rb
  15. +1 −1  lib/{octopussy → octokit}/client/request.rb
  16. +1 −1  lib/{octopussy → octokit}/client/timelines.rb
  17. +1 −1  lib/{octopussy → octokit}/client/users.rb
  18. +2 −2 lib/{octopussy → octokit}/configuration.rb
  19. +1 −1  lib/{octopussy → octokit}/event.rb
  20. +1 −1  lib/{octopussy → octokit}/repository.rb
  21. +3 −0  lib/octokit/version.rb
  22. +0 −30 lib/octopussy/client.rb
  23. +0 −3  lib/octopussy/version.rb
  24. +5 −5 octopussy.gemspec → octokit.gemspec
  25. +21 −21 test/fixtures/timeline.json
  26. +3 −3 test/helper.rb
  27. +68 −68 test/{octopussy_test.rb → octokit_test.rb}
  28. +3 −3 test/repository_test.rb
View
2  LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2010 Wynn Netherland
+Copyright (c) 2011 Wynn Netherland, Adam Stacoviak, Erik Michaels-Ober
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
77 README.markdown
@@ -1,68 +1,69 @@
-# octopussy
-
-<img src='http://upload.wikimedia.org/wikipedia/en/b/bb/007Octopussyposter.jpg' style='float: right; margin: 0 0 10px 10px'/>
-
+Octokit
+=======
Simple Ruby wrapper for the GitHub v2 API.
-## Installation
-
- sudo gem install octopussy
+Installation
+------------
+ gem install octokit
-## Some examples
+Some examples
+-------------
### Show a user
- Octopussy.user('pengwynn')
+ Octokit.user('pengwynn')
=> <#Hashie::Mash blog="http://wynnnetherland.com" company="Orrka" created_at="2008/02/25 10:24:19 -0800" email="wynn.netherland@gmail.com" followers_count=21 following_count=55 id=865 location="Dallas, TX" login="pengwynn" name="Wynn Netherland" public_gist_count=4 public_repo_count=16>
### Show who a user follows
- Octopussy.following('pengwynn')
+ Octokit.following('pengwynn')
=> ["cglee", "bryansray", "rails", "zachinglis", "wycats", "obie", "mully", "squeejee", "jderrett", "Shopify", "ReinH", "technoweenie", "errfree", "defunkt", "joshsusser", "hashrocket", "newbamboo", "bigtiger", "github", "jamis", "jeresig", "thoughtbot", "therealadam", "jnunemaker", "seaofclouds", "choan", "llimllib", "kwhinnery", "marshall", "handcrafted", "adamstac", "jashkenas", "dan", "remy", "hayesdavis", "documentcloud", "imathis", "mdeiters", "njonsson", "asenchi", "mattsa", "marclove", "webiest", "brogers", "polomasta", "stephp", "mchelen", "piyush", "davidnorth", "rmetzler", "jferris", "madrobby", "zh", "erikvold", "desandro"]
-## Working with repositories
-
+Working with repositories
+-------------------------
For convenience, methods that require a repo argument may be passed in any of the following forms
* "pengwynn/linked"
* {:username => 'pengwynn', :name => 'linkedin'}
* {:username => 'pengwynn', :repo => 'linkedin'}
-* instance of Repo
+* instance of Repository
### Show a repo
- Octopussy.repo("pengwynn/linkedin")
+ Octokit.repo("pengwynn/linkedin")
=> <#Hashie::Mash description="Ruby wrapper for the LinkedIn API" fork=false forks=1 homepage="http://bit.ly/ruby-linkedin" name="linkedin" open_issues=2 owner="pengwynn" private=false url="http://github.com/pengwynn/linkedin" watchers=36>
-## Authenticated requests
-
+Authenticated requests
+----------------------
Some methods require authentication so you'll need to pass a login and an api_token. You can find your GitHub API token on your [account page](https://github.com/account)
- client = Octopussy::Client.new(:login => 'pengwynn', :token => 'OU812')
+ client = Octokit::Client.new(:login => 'pengwynn', :token => 'OU812')
client.follow!('adamstac')
-Read the full [docs](http://rdoc.info/projects/pengwynn/octopussy) or check out the [examples](http://github.com/pengwynn/octopussy/tree/master/examples)
-
-## TODO
+Read the full [docs](http://rdoc.info/projects/pengwynn/octokit)
+TODO
+----
* Feed parsing
* More examples
-## Note on Patches/Pull Requests
-
-* Fork the project.
-* Make your feature addition or bug fix.
-* Add tests for it. This is important so I don't break it in a
- future version unintentionally.
-* Commit, do not mess with rakefile, version, or history.
- (if you want to have your own version, that is fine but
- bump version in a commit by itself I can ignore when I pull)
-* Send me a pull request. Bonus points for topic branches.
-
-## Credits
-
-Octopussy is inspired by [Octopi](http://github.com/fcoury/octopi) and aims to be a lightweight, less active-resourcey alternative.
-
-## Copyright
-
-Copyright (c) 2009 [Wynn Netherland](http://wynnnetherland.com), [Adam Stacoviak](http://adamstacoviak.com/). See LICENSE for details.
+Submitting a Pull Request
+-------------------------
+1. Fork the project.
+2. Create a topic branch.
+3. Implement your feature or bug fix.
+4. Add documentation for your feature or bug fix.
+5. Run <tt>bundle exec rake doc:yard</tt>. If your changes are not 100% documented, go back to step 4.
+6. Add specs for your feature or bug fix.
+7. Run <tt>bundle exec rake spec</tt>. If your changes are not 100% covered, go back to step 6.
+8. Commit and push your changes.
+9. Submit a pull request. Please do not include changes to the version or gemspec. (If you want to create your own version for some reason, please do so in a separate commit.)
+
+Credits
+-------
+Octokit is inspired by [Octopi](http://github.com/fcoury/octopi) and aims to be a lightweight, less active-resourcey alternative.
+
+Copyright
+---------
+Copyright (c) 2011 [Wynn Netherland](http://wynnnetherland.com), [Adam Stacoviak](http://adamstacoviak.com/), [Erik Michaels-Ober](https://github.com/sferik).
+See [LICENSE](https://github.com/pengwynn/octokit/blob/master/LICENSE) for details.
View
18 lib/faraday/raise_error.rb
@@ -7,23 +7,23 @@ def self.register_on_complete(env)
env[:response].on_complete do |response|
case response[:status].to_i
when 400
- raise Octopussy::BadRequest, error_message(response)
+ raise Octokit::BadRequest, error_message(response)
when 401
- raise Octopussy::Unauthorized, error_message(response)
+ raise Octokit::Unauthorized, error_message(response)
when 403
- raise Octopussy::Forbidden, error_message(response)
+ raise Octokit::Forbidden, error_message(response)
when 404
- raise Octopussy::NotFound, error_message(response)
+ raise Octokit::NotFound, error_message(response)
when 406
- raise Octopussy::NotAcceptable, error_message(response)
+ raise Octokit::NotAcceptable, error_message(response)
when 500
- raise Octopussy::InternalServerError, error_message(response)
+ raise Octokit::InternalServerError, error_message(response)
when 501
- raise Octopussy::NotImplemented, error_message(response)
+ raise Octokit::NotImplemented, error_message(response)
when 502
- raise Octopussy::BadGateway, error_message(response)
+ raise Octokit::BadGateway, error_message(response)
when 503
- raise Octopussy::ServiceUnavailable, error_message(response)
+ raise Octokit::ServiceUnavailable, error_message(response)
end
end
end
View
14 lib/octopussy.rb → lib/octokit.rb
@@ -1,17 +1,17 @@
-require File.expand_path('../octopussy/configuration', __FILE__)
-require File.expand_path('../octopussy/client', __FILE__)
+require File.expand_path('../octokit/configuration', __FILE__)
+require File.expand_path('../octokit/client', __FILE__)
-module Octopussy
+module Octokit
extend Configuration
- # Alias for Octopussy::Client.new
+ # Alias for Octokit::Client.new
#
- # @return [Octopussy::Client]
+ # @return [Octokit::Client]
def self.client(options={})
- Octopussy::Client.new(options)
+ Octokit::Client.new(options)
end
- # Delegate to Octopussy::Client.new
+ # Delegate to Octokit::Client.new
def self.method_missing(method, *args, &block)
return super unless client.respond_to?(method)
client.send(method, *args, &block)
View
30 lib/octokit/client.rb
@@ -0,0 +1,30 @@
+require File.expand_path('../event', __FILE__)
+require File.expand_path('../repository', __FILE__)
+Dir[File.expand_path('../client/*.rb', __FILE__)].each{|file| require file}
+
+module Octokit
+ class Client
+ attr_accessor *Configuration::VALID_OPTIONS_KEYS
+
+ def initialize(options={})
+ options = Octokit.options.merge(options)
+ Configuration::VALID_OPTIONS_KEYS.each do |key|
+ send("#{key}=", options[key])
+ end
+ end
+
+ include Octokit::Client::Authentication
+ include Octokit::Client::Connection
+ include Octokit::Client::Request
+
+ include Octokit::Client::Commits
+ include Octokit::Client::Issues
+ include Octokit::Client::Network
+ include Octokit::Client::Objects
+ include Octokit::Client::Organizations
+ include Octokit::Client::Pulls
+ include Octokit::Client::Repositories
+ include Octokit::Client::Timelines
+ include Octokit::Client::Users
+ end
+end
View
2  lib/octopussy/client/authentication.rb → lib/octokit/client/authentication.rb
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Authentication
def authentication
View
2  lib/octopussy/client/commits.rb → lib/octokit/client/commits.rb
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Commits
View
2  lib/octopussy/client/connection.rb → lib/octokit/client/connection.rb
@@ -1,7 +1,7 @@
require 'faraday_middleware'
Dir[File.expand_path('../../../faraday/*.rb', __FILE__)].each{|file| require file}
-module Octopussy
+module Octokit
class Client
# @private
module Connection
View
2  lib/octopussy/client/issues.rb → lib/octokit/client/issues.rb
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Issues
View
2  lib/octopussy/client/network.rb → lib/octokit/client/network.rb
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Network
View
2  lib/octopussy/client/objects.rb → lib/octokit/client/objects.rb
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Objects
View
2  lib/octopussy/client/organizations.rb → lib/octokit/client/organizations.rb
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Organizations
View
2  lib/octopussy/client/pulls.rb → lib/octokit/client/pulls.rb
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Pulls
def create_pull_request(repo, options={})
View
2  lib/octopussy/client/repositories.rb → lib/octokit/client/repositories.rb
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Repositories
View
2  lib/octopussy/client/request.rb → lib/octokit/client/request.rb
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Request
def get(path, options={}, raw=false, format_path=true)
View
2  lib/octopussy/client/timelines.rb → lib/octokit/client/timelines.rb
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Timelines
View
2  lib/octopussy/client/users.rb → lib/octokit/client/users.rb
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Users
EMAIL_RE = /[\w.!#\$%+-]+@[\w-]+(?:\.[\w-]+)+/
View
4 lib/octopussy/configuration.rb → lib/octokit/configuration.rb
@@ -1,7 +1,7 @@
require 'faraday'
require File.expand_path('../version', __FILE__)
-module Octopussy
+module Octokit
module Configuration
VALID_OPTIONS_KEYS = [:adapter, :endpoint, :format, :login, :password, :proxy, :token, :user_agent, :version].freeze
VALID_FORMATS = [:json, :xml, :yaml].freeze
@@ -13,7 +13,7 @@ module Configuration
DEFAULT_PASSWORD = nil.freeze
DEFAULT_PROXY = nil.freeze
DEFAULT_TOKEN = nil.freeze
- DEFAULT_USER_AGENT = "Octopussy Ruby Gem #{Octopussy::VERSION}".freeze
+ DEFAULT_USER_AGENT = "Octokit Ruby Gem #{Octokit::VERSION}".freeze
DEFAULT_VERSION = 2
attr_accessor *VALID_OPTIONS_KEYS
View
2  lib/octopussy/event.rb → lib/octokit/event.rb
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Event
def self.load_from_atom(entry)
View
2  lib/octopussy/repository.rb → lib/octokit/repository.rb
@@ -1,6 +1,6 @@
require 'addressable/uri'
-module Octopussy
+module Octokit
class Repository
attr_accessor :username, :name
View
3  lib/octokit/version.rb
@@ -0,0 +1,3 @@
+module Octokit
+ VERSION = "0.3.0".freeze unless defined?(Octokit::VERSION)
+end
View
30 lib/octopussy/client.rb
@@ -1,30 +0,0 @@
-require File.expand_path('../event', __FILE__)
-require File.expand_path('../repository', __FILE__)
-Dir[File.expand_path('../client/*.rb', __FILE__)].each{|file| require file}
-
-module Octopussy
- class Client
- attr_accessor *Configuration::VALID_OPTIONS_KEYS
-
- def initialize(options={})
- options = Octopussy.options.merge(options)
- Configuration::VALID_OPTIONS_KEYS.each do |key|
- send("#{key}=", options[key])
- end
- end
-
- include Octopussy::Client::Authentication
- include Octopussy::Client::Connection
- include Octopussy::Client::Request
-
- include Octopussy::Client::Commits
- include Octopussy::Client::Issues
- include Octopussy::Client::Network
- include Octopussy::Client::Objects
- include Octopussy::Client::Organizations
- include Octopussy::Client::Pulls
- include Octopussy::Client::Repositories
- include Octopussy::Client::Timelines
- include Octopussy::Client::Users
- end
-end
View
3  lib/octopussy/version.rb
@@ -1,3 +0,0 @@
-module Octopussy
- VERSION = "0.3.0".freeze unless defined?(Octopussy::VERSION)
-end
View
10 octopussy.gemspec → octokit.gemspec
@@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
-require File.expand_path('../lib/octopussy/version', __FILE__)
+require File.expand_path('../lib/octokit/version', __FILE__)
Gem::Specification.new do |s|
s.add_development_dependency('fakeweb', '~> 1.3')
@@ -17,17 +17,17 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('faraday_middleware', '~> 0.3.1')
s.add_runtime_dependency('multi_json', '~> 0.0.5')
s.add_runtime_dependency('multi_xml', '~> 0.2.0')
- s.name = 'octopussy'
- s.authors = ["Wynn Netherland", "Adam Stacoviak"]
+ s.name = 'octokit'
+ s.authors = ["Wynn Netherland", "Adam Stacoviak", "Erik Michaels-Ober"]
s.description = %q{Simple wrapper for the GitHub API v2}
s.email = ['wynn.netherland@gmail.com']
s.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
s.files = `git ls-files`.split("\n")
- s.homepage = 'http://wynnnetherland.com/projects/octopussy/'
+ s.homepage = 'http://wynnnetherland.com/projects/octokit/'
s.require_paths = ['lib']
s.summary = %q{Wrapper for the GitHub API}
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- s.version = Octopussy::VERSION.dup
+ s.version = Octokit::VERSION.dup
s.platform = Gem::Platform::RUBY
s.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if s.respond_to? :required_rubygems_version=
end
View
42 test/fixtures/timeline.json
@@ -15,7 +15,7 @@
"has_downloads": true,
"watchers": 19,
"forks": 7,
- "url": "http://github.com/pengwynn/octopussy",
+ "url": "http://github.com/pengwynn/octokit",
"homepage": "",
"has_wiki": true,
"fork": false,
@@ -24,7 +24,7 @@
"pushed_at": "2010/06/17 09:17:37 -0700",
"private": false,
"has_issues": true,
- "name": "octopussy",
+ "name": "octokit",
"owner": "pengwynn"
},
"created_at": "2010/06/17 09:17:37 -0700",
@@ -32,11 +32,11 @@
"public": true,
"actor": "pengwynn",
"payload": {
- "name": "octopussy",
+ "name": "octokit",
"object_name": "v0.2.3",
"object": "tag"
},
- "url": "http://github.com/pengwynn/octopussy/tree/v0.2.3",
+ "url": "http://github.com/pengwynn/octokit/tree/v0.2.3",
"times": 0,
"type": "CreateEvent"
},
@@ -46,7 +46,7 @@
"has_downloads": true,
"watchers": 19,
"forks": 7,
- "url": "http://github.com/pengwynn/octopussy",
+ "url": "http://github.com/pengwynn/octokit",
"homepage": "",
"has_wiki": true,
"fork": false,
@@ -55,7 +55,7 @@
"pushed_at": "2010/06/17 09:17:37 -0700",
"private": false,
"has_issues": true,
- "name": "octopussy",
+ "name": "octokit",
"owner": "pengwynn"
},
"created_at": "2010/06/17 09:17:36 -0700",
@@ -68,7 +68,7 @@
"shas": [["c06905d5db1847ade958853389112238f89d8ec5", "sutto@sutto.net", "Use authentication with list repos if available", "Darcy Laycock"], ["2efeb73934ae30e7091385fa6c2e81c994a60bb9", "wynn.netherland@gmail.com", "updated changelog", "Wynn Netherland"], ["91f602cf588824df011f532c69af31cb2f2e23ef", "wynn.netherland@gmail.com", "Version bump to 0.2.3", "Wynn Netherland"], ["9d5a78a7253f2e4871609cf16ca55ba3e9fae8cb", "wynn.netherland@gmail.com", "updated homepage", "Wynn Netherland"], ["1e87f1640f0e7b6d3854cdf9d089092d9118be6c", "wynn.netherland@gmail.com", "Regenerated gemspec for version 0.2.3", "Wynn Netherland"]],
"ref": "refs/heads/master"
},
- "url": "http://github.com/pengwynn/octopussy/compare/4c1b9fcbe1...1e87f1640f",
+ "url": "http://github.com/pengwynn/octokit/compare/4c1b9fcbe1...1e87f1640f",
"times": 0,
"type": "PushEvent"
},
@@ -89,7 +89,7 @@
"has_downloads": true,
"watchers": 19,
"forks": 7,
- "url": "http://github.com/pengwynn/octopussy",
+ "url": "http://github.com/pengwynn/octokit",
"homepage": "",
"has_wiki": true,
"fork": false,
@@ -98,7 +98,7 @@
"pushed_at": "2010/06/17 09:17:37 -0700",
"private": false,
"has_issues": true,
- "name": "octopussy",
+ "name": "octokit",
"owner": "pengwynn"
},
"created_at": "2010/06/17 09:12:34 -0700",
@@ -110,7 +110,7 @@
"commit": "c06905d5db1847ade958853389112238f89d8ec5",
"original": "4c1b9fcbe1f812c49c26f973f4b059df63df8f6c"
},
- "url": "http://github.com/pengwynn/octopussy/tree/integration",
+ "url": "http://github.com/pengwynn/octokit/tree/integration",
"times": 0,
"type": "ForkApplyEvent"
},
@@ -120,7 +120,7 @@
"has_downloads": true,
"watchers": 19,
"forks": 7,
- "url": "http://github.com/pengwynn/octopussy",
+ "url": "http://github.com/pengwynn/octokit",
"homepage": "",
"has_wiki": true,
"fork": false,
@@ -129,7 +129,7 @@
"pushed_at": "2010/06/17 09:17:37 -0700",
"private": false,
"has_issues": true,
- "name": "octopussy",
+ "name": "octokit",
"owner": "pengwynn"
},
"created_at": "2010/06/17 09:12:13 -0700",
@@ -142,7 +142,7 @@
"shas": [["3b02fc367fb7db1f9c8a24a7e8a89ad0459e319b", "wynn.netherland@gmail.com", "Regenerated gemspec for version 0.2.1", "Wynn Netherland"], ["83c3c5bc39f863b3568ae0c6cb408d90274e2ca5", "abrader@itmat.upenn.edu", "Added the auth_params query to the blob, tree, and repo class methods", "Andrew Brader"], ["cee9d0682831b168fb4449dcd7c442ae1c02ba92", "wynn.netherland@gmail.com", "rev'd hashie", "Wynn Netherland"], ["fc8694bc75e009eac08ba836e56b845b0431f642", "wynn.netherland@gmail.com", "Version bump to 0.2.2", "Wynn Netherland"], ["b7083aba6444f9da95df28873f93f5fdd5c5a452", "wynn.netherland@gmail.com", "Patch for auth params", "Wynn Netherland"], ["775a5f1df314c88049b2d7696a56fe07c09eb770", "wynn.netherland@gmail.com", "Merge branch 'integration'", "Wynn Netherland"], ["5b24bf1c610e15e5b7d3b8b10d9c300311692818", "wynn.netherland@gmail.com", "updated changelog", "Wynn Netherland"], ["4c1b9fcbe1f812c49c26f973f4b059df63df8f6c", "wynn.netherland@gmail.com", "Regenerated gemspec for version 0.2.2", "Wynn Netherland"]],
"ref": "refs/heads/integration"
},
- "url": "http://github.com/pengwynn/octopussy/compare/85cb4af26c...4c1b9fcbe1",
+ "url": "http://github.com/pengwynn/octokit/compare/85cb4af26c...4c1b9fcbe1",
"times": 0,
"type": "PushEvent"
},
@@ -615,7 +615,7 @@
"has_downloads": true,
"watchers": 19,
"forks": 7,
- "url": "http://github.com/pengwynn/octopussy",
+ "url": "http://github.com/pengwynn/octokit",
"homepage": "",
"has_wiki": true,
"fork": false,
@@ -624,7 +624,7 @@
"pushed_at": "2010/06/17 09:17:37 -0700",
"private": false,
"has_issues": true,
- "name": "octopussy",
+ "name": "octokit",
"owner": "pengwynn"
},
"created_at": "2010/06/08 20:38:47 -0700",
@@ -632,11 +632,11 @@
"public": true,
"actor": "pengwynn",
"payload": {
- "name": "octopussy",
+ "name": "octokit",
"object_name": "v0.2.2",
"object": "tag"
},
- "url": "http://github.com/pengwynn/octopussy/tree/v0.2.2",
+ "url": "http://github.com/pengwynn/octokit/tree/v0.2.2",
"times": 0,
"type": "CreateEvent"
},
@@ -646,7 +646,7 @@
"has_downloads": true,
"watchers": 19,
"forks": 7,
- "url": "http://github.com/pengwynn/octopussy",
+ "url": "http://github.com/pengwynn/octokit",
"homepage": "",
"has_wiki": true,
"fork": false,
@@ -655,7 +655,7 @@
"pushed_at": "2010/06/17 09:17:37 -0700",
"private": false,
"has_issues": true,
- "name": "octopussy",
+ "name": "octokit",
"owner": "pengwynn"
},
"created_at": "2010/06/08 20:38:40 -0700",
@@ -668,7 +668,7 @@
"shas": [["83c3c5bc39f863b3568ae0c6cb408d90274e2ca5", "abrader@itmat.upenn.edu", "Added the auth_params query to the blob, tree, and repo class methods", "Andrew Brader"], ["cee9d0682831b168fb4449dcd7c442ae1c02ba92", "wynn.netherland@gmail.com", "rev'd hashie", "Wynn Netherland"], ["fc8694bc75e009eac08ba836e56b845b0431f642", "wynn.netherland@gmail.com", "Version bump to 0.2.2", "Wynn Netherland"], ["b7083aba6444f9da95df28873f93f5fdd5c5a452", "wynn.netherland@gmail.com", "Patch for auth params", "Wynn Netherland"], ["775a5f1df314c88049b2d7696a56fe07c09eb770", "wynn.netherland@gmail.com", "Merge branch 'integration'", "Wynn Netherland"], ["5b24bf1c610e15e5b7d3b8b10d9c300311692818", "wynn.netherland@gmail.com", "updated changelog", "Wynn Netherland"], ["4c1b9fcbe1f812c49c26f973f4b059df63df8f6c", "wynn.netherland@gmail.com", "Regenerated gemspec for version 0.2.2", "Wynn Netherland"]],
"ref": "refs/heads/master"
},
- "url": "http://github.com/pengwynn/octopussy/compare/3b02fc367f...4c1b9fcbe1",
+ "url": "http://github.com/pengwynn/octokit/compare/3b02fc367f...4c1b9fcbe1",
"times": 0,
"type": "PushEvent"
},
@@ -1015,4 +1015,4 @@
"url": "http://github.com/pengwynn/groupon/compare/9e927a5e68...37836c2208",
"times": 0,
"type": "PushEvent"
-}]
+}]
View
6 test/helper.rb
@@ -8,7 +8,7 @@
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
-require 'octopussy'
+require 'octokit'
FakeWeb.allow_net_connect = false
@@ -25,9 +25,9 @@ def github_url(url)
if url =~ /^http/
url
elsif @client && @client.authenticated?
- "https://pengwynn%2Ftoken:OU812@github.com/api/v#{Octopussy.version}/#{Octopussy.format}/#{url}"
+ "https://pengwynn%2Ftoken:OU812@github.com/api/v#{Octokit.version}/#{Octokit.format}/#{url}"
else
- "https://github.com/api/v#{Octopussy.version}/#{Octopussy.format}/#{url}"
+ "https://github.com/api/v#{Octokit.version}/#{Octokit.format}/#{url}"
end
end
View
136 test/octopussy_test.rb → test/octokit_test.rb
@@ -1,10 +1,10 @@
require File.expand_path(File.dirname(__FILE__) + '/helper')
-class OctopussyTest < Test::Unit::TestCase
+class OctokitTest < Test::Unit::TestCase
context "when authenticated" do
setup do
- @client = Octopussy::Client.new(:login => 'pengwynn', :token => 'OU812')
+ @client = Octokit::Client.new(:login => 'pengwynn', :token => 'OU812')
end
should "should search users" do
@@ -241,14 +241,14 @@ class OctopussyTest < Test::Unit::TestCase
stub_get("https://pengwynn%2Ftoken:OU812@github.com/pengwynn.json", "timeline.json")
events = @client.public_timeline('pengwynn')
events.first['type'].should == 'FollowEvent'
- events[1].repository.name.should == 'octopussy'
+ events[1].repository.name.should == 'octokit'
end
should "fetch a user's private timeline" do
stub_get("https://pengwynn%2Ftoken:OU812@github.com/pengwynn.private.json", "timeline.json")
events = @client.timeline
events.first['type'].should == 'FollowEvent'
- events[1].repository.name.should == 'octopussy'
+ events[1].repository.name.should == 'octokit'
end
end
@@ -257,13 +257,13 @@ class OctopussyTest < Test::Unit::TestCase
should "search users" do
stub_get("user/search/wynn", "search.json")
- users = Octopussy.search_users("wynn")
+ users = Octokit.search_users("wynn")
users.first.username.should == 'pengwynn'
end
should "return user info" do
stub_get("user/show/pengwynn", "user.json")
- user = Octopussy.user("pengwynn")
+ user = Octokit.user("pengwynn")
user.login.should == 'pengwynn'
user.blog.should == 'http://wynnnetherland.com'
user.name.should == 'Wynn Netherland'
@@ -271,47 +271,47 @@ class OctopussyTest < Test::Unit::TestCase
should "return followers for a user" do
stub_get("user/show/pengwynn/followers", "followers.json")
- followers = Octopussy.followers("pengwynn")
+ followers = Octokit.followers("pengwynn")
followers.size.should == 21
assert followers.include?("adamstac")
end
should "indicate if one user follows another" do
stub_get("user/show/pengwynn/following", "followers.json")
- assert Octopussy.follows?('pengwynn', 'adamstac')
+ assert Octokit.follows?('pengwynn', 'adamstac')
end
should "return users a user follows" do
stub_get("user/show/pengwynn/following", "followers.json")
- followers = Octopussy.following("pengwynn")
+ followers = Octokit.following("pengwynn")
followers.size.should == 21
assert followers.include?("adamstac")
end
should "return the repos a user watches" do
stub_get("repos/watched/pengwynn", "repos.json")
- repos = Octopussy.watched('pengwynn')
+ repos = Octokit.watched('pengwynn')
repos.first.owner.should == 'jnunemaker'
repos.first.forks.should == 120
end
should "search issues for a repo" do
stub_get("issues/search/jnunemaker/twitter/open/httparty", "issues.json")
- issues = Octopussy.search_issues({:username => 'jnunemaker', :repo => 'twitter'}, 'httparty')
+ issues = Octokit.search_issues({:username => 'jnunemaker', :repo => 'twitter'}, 'httparty')
issues.first.title.should == 'Crack error when creating friendship'
issues.first.votes.should == 2
end
should "list issues for a repo" do
stub_get("issues/list/jnunemaker/twitter/open", "issues.json")
- issues = Octopussy.issues({:username => 'jnunemaker', :repo => 'twitter'}, 'open')
+ issues = Octokit.issues({:username => 'jnunemaker', :repo => 'twitter'}, 'open')
issues.first.title.should == 'Crack error when creating friendship'
issues.first.votes.should == 2
end
should "return issue info" do
stub_get("issues/show/jnunemaker/twitter/3", "issue.json")
- issue = Octopussy.issue({:username => 'jnunemaker', :repo => 'twitter'}, 3)
+ issue = Octokit.issue({:username => 'jnunemaker', :repo => 'twitter'}, 3)
issue.title.should == 'Crack error when creating friendship'
issue.votes.should == 2
end
@@ -320,96 +320,96 @@ class OctopussyTest < Test::Unit::TestCase
should "search repos" do
stub_get("repos/search/compass", "repo_search.json")
- repos = Octopussy.search_repos("compass")
+ repos = Octokit.search_repos("compass")
repos.first.username.should == 'chriseppstein'
repos.first.language.should == 'Ruby'
end
should "return repo information" do
stub_get("repos/show/pengwynn/linkedin", "repo.json")
- repo = Octopussy.repo({:username => "pengwynn", :repo => "linkedin"})
+ repo = Octokit.repo({:username => "pengwynn", :repo => "linkedin"})
repo.homepage.should == "http://bit.ly/ruby-linkedin"
end
should "return a repo's contributors list" do
stub_get("repos/show/pengwynn/linkedin/contributors", "contributors.json")
- contributors_list = Octopussy.contributors({:username => "pengwynn", :repo => "linkedin"})
+ contributors_list = Octokit.contributors({:username => "pengwynn", :repo => "linkedin"})
assert contributors_list.include?(["holman", 1])
end
should "list repos for a user" do
stub_get("repos/show/pengwynn", "repos.json")
- repos = Octopussy.list_repos('pengwynn')
+ repos = Octokit.list_repos('pengwynn')
repos.first.name.should == 'twitter'
repos.first.watchers.should == 609
end
should "list collaborators for a repo" do
- stub_get("repos/show/pengwynn/octopussy/collaborators", "collaborators.json")
- users = Octopussy.collaborators({:username => "pengwynn", :repo => "octopussy"})
+ stub_get("repos/show/pengwynn/octokit/collaborators", "collaborators.json")
+ users = Octokit.collaborators({:username => "pengwynn", :repo => "octokit"})
users.last.should == 'adamstac'
end
should "show the network for a repo" do
stub_get("repos/show/pengwynn/linkedin/network", "network.json")
- network = Octopussy.network({:username => 'pengwynn', :repo => "linkedin"})
+ network = Octokit.network({:username => 'pengwynn', :repo => "linkedin"})
network.last.owner.should == 'nfo'
end
should "show the language breakdown for a repo" do
stub_get("repos/show/pengwynn/linkedin/languages", "languages.json")
- languages = Octopussy.languages({:username => 'pengwynn', :repo => "linkedin"})
+ languages = Octokit.languages({:username => 'pengwynn', :repo => "linkedin"})
languages['Ruby'].should == 21515
end
should "list all the tags in a repo" do
stub_get("repos/show/pengwynn/linkedin/tags", "tags.json")
- tags = Octopussy.tags(:username => 'pengwynn', :repo => "linkedin")
+ tags = Octokit.tags(:username => 'pengwynn', :repo => "linkedin")
assert tags.include?("v0.0.1")
end
should "list all the branches in a repo" do
stub_get("repos/show/pengwynn/linkedin/branches", "branches.json")
- branches = Octopussy.branches(:username => 'pengwynn', :repo => "linkedin")
+ branches = Octokit.branches(:username => 'pengwynn', :repo => "linkedin")
assert branches.include?("integration")
end
# network
should "return network meta info for a repo" do
stub_get("https://github.com/schacon/simplegit/network_meta", "network_meta.json")
- info = Octopussy.network_meta(:username => "schacon", :repo => "simplegit")
+ info = Octokit.network_meta(:username => "schacon", :repo => "simplegit")
info.users.first.name.should == 'schacon'
info.users.first.repo.should == 'simplegit'
end
should "return first 100 commits by branch" do
stub_get("https://github.com/schacon/simplegit/network_data_chunk?nethash=fa8fe264b926cdebaab36420b6501bd74402a6ff", "network_data.json")
- info = Octopussy.network_data({:username => "schacon", :repo => "simplegit"}, "fa8fe264b926cdebaab36420b6501bd74402a6ff")
+ info = Octokit.network_data({:username => "schacon", :repo => "simplegit"}, "fa8fe264b926cdebaab36420b6501bd74402a6ff")
assert info.is_a?(Array)
end
# trees
should "return contents of a tree by tree SHA" do
stub_get("tree/show/defunkt/facebox/a47803c9ba26213ff194f042ab686a7749b17476", "trees.json")
- trees = Octopussy.tree({:username => "defunkt", :repo => "facebox"}, "a47803c9ba26213ff194f042ab686a7749b17476")
+ trees = Octokit.tree({:username => "defunkt", :repo => "facebox"}, "a47803c9ba26213ff194f042ab686a7749b17476")
trees.first.name.should == '.gitignore'
trees.first.sha.should == 'e43b0f988953ae3a84b00331d0ccf5f7d51cb3cf'
end
should "return data about a blob by tree SHA and path" do
stub_get("blob/show/defunkt/facebox/d4fc2d5e810d9b4bc1ce67702603080e3086a4ed/README.txt", "blob.json")
- blob = Octopussy.blob({:username => "defunkt", :repo => "facebox"}, "d4fc2d5e810d9b4bc1ce67702603080e3086a4ed", "README.txt")
+ blob = Octokit.blob({:username => "defunkt", :repo => "facebox"}, "d4fc2d5e810d9b4bc1ce67702603080e3086a4ed", "README.txt")
blob.name.should == 'README.txt'
blob.sha.should == 'd4fc2d5e810d9b4bc1ce67702603080e3086a4ed'
end
should "return the contents of a blob with the blob's SHA" do
begin
- Octopussy.format = :yaml
+ Octokit.format = :yaml
stub_get("blob/show/defunkt/facebox/4bf7a39e8c4ec54f8b4cd594a3616d69004aba69", "raw_git_data.yaml")
- raw_text = Octopussy.raw({:username => "defunkt", :repo => "facebox"}, "4bf7a39e8c4ec54f8b4cd594a3616d69004aba69")
+ raw_text = Octokit.raw({:username => "defunkt", :repo => "facebox"}, "4bf7a39e8c4ec54f8b4cd594a3616d69004aba69")
ensure
- Octopussy.format = :json
+ Octokit.format = :json
end
assert raw_text.include?("cd13d9a61288dceb0a7aa73b55ed2fd019f4f1f7")
end
@@ -417,20 +417,20 @@ class OctopussyTest < Test::Unit::TestCase
#commits
should "list commits for a repo's master branch by default" do
stub_get("commits/list/defunkt/facebox/master", "commits.json")
- commits_list = Octopussy.list_commits({:username => "defunkt", :repo => "facebox"})
+ commits_list = Octokit.list_commits({:username => "defunkt", :repo => "facebox"})
assert commits_list.any? { |c| c.message == "Fixed CSS expression, throwing errors in IE6." }
end
should "list commits for a repo on a given branch" do
stub_get("commits/list/schacon/simplegit/m/dev/cp", "branch_commits.json")
- commits_list = Octopussy.list_commits({:username => "schacon", :repo => "simplegit"}, "m/dev/cp")
+ commits_list = Octokit.list_commits({:username => "schacon", :repo => "simplegit"}, "m/dev/cp")
assert commits_list.any? { |c| c.message == "removed unnecessary test code" }
end
should "show a specific commit for a repo given its SHA" do
sha = "1ff368f79b0f0aa0e1f1d78bcaa8691f94f9703e"
stub_get("commits/show/defunkt/facebox/#{sha}", "show_commit.json")
- show_commit = Octopussy.commit({:username => "defunkt", :repo => "facebox"}, sha)
+ show_commit = Octokit.commit({:username => "defunkt", :repo => "facebox"}, sha)
assert show_commit.message == "Fixed CSS expression, throwing errors in IE6."
end
@@ -438,42 +438,42 @@ class OctopussyTest < Test::Unit::TestCase
should "fetch the public timeline" do
stub_get("https://github.com/timeline.json", "timeline.json")
- events = Octopussy.public_timeline
+ events = Octokit.public_timeline
events.first['type'].should == 'FollowEvent'
- events[1].repository.name.should == 'octopussy'
+ events[1].repository.name.should == 'octokit'
end
should "fetch a user's public timeline" do
stub_get("https://github.com/pengwynn.json", "timeline.json")
- events = Octopussy.public_timeline('pengwynn')
+ events = Octokit.public_timeline('pengwynn')
events.first['type'].should == 'FollowEvent'
- events[1].repository.name.should == 'octopussy'
+ events[1].repository.name.should == 'octokit'
end
end
context "when Github responds with an error" do
{
- ["400", "BadRequest"] => Octopussy::BadRequest,
- ["401", "Unauthorized"] => Octopussy::Unauthorized,
- ["403", "Forbidden"] => Octopussy::Forbidden,
- ["404", "NotFound"] => Octopussy::NotFound,
- ["406", "NotAcceptable"] => Octopussy::NotAcceptable,
- ["500", "InternalServerError"] => Octopussy::InternalServerError,
- ["501", "NotImplemented"] => Octopussy::NotImplemented,
- ["502", "BadGateway"] => Octopussy::BadGateway,
- ["503", "ServiceUnavailable"] => Octopussy::ServiceUnavailable,
+ ["400", "BadRequest"] => Octokit::BadRequest,
+ ["401", "Unauthorized"] => Octokit::Unauthorized,
+ ["403", "Forbidden"] => Octokit::Forbidden,
+ ["404", "NotFound"] => Octokit::NotFound,
+ ["406", "NotAcceptable"] => Octokit::NotAcceptable,
+ ["500", "InternalServerError"] => Octokit::InternalServerError,
+ ["501", "NotImplemented"] => Octokit::NotImplemented,
+ ["502", "BadGateway"] => Octokit::BadGateway,
+ ["503", "ServiceUnavailable"] => Octokit::ServiceUnavailable,
}.each do |status, exception|
context "#{status.first}, a get" do
should "raise an #{exception.name} error" do
stub_get("user/show/pengwynn", nil, status)
- lambda { Octopussy.user("pengwynn") }.should raise_error(exception)
+ lambda { Octokit.user("pengwynn") }.should raise_error(exception)
end
end
context "#{status.first}, a post" do
should "raise an #{exception.name} error" do
- @client = Octopussy::Client.new(:login => 'pengwynn', :token => 'OU812')
+ @client = Octokit::Client.new(:login => 'pengwynn', :token => 'OU812')
stub_post("user/show/pengwynn", nil, status)
lambda { @client.update_user(:location => "Dallas, TX") }.should raise_error(exception)
end
@@ -493,7 +493,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'pengwynn'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.user.should == 'pengwynn'
event.published.year.should == 2009
event.published.month.should == 12
@@ -512,7 +512,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'Tanner'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'repo'
event.repo.username.should == 'Tanner'
event.repo.name.should == 'Team-1261---Java'
@@ -528,7 +528,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'pengwynn'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'tag'
event.repo.username.should == 'jnunemaker'
event.repo.name.should == 'twitter'
@@ -545,7 +545,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'cwcore'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'branch'
event.repo.username.should == 'Fabi'
event.repo.name.should == 'cwcore'
@@ -563,7 +563,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'pengwynn'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'push'
event.repo.name.should == 'twitter'
event.branch.should == 'master'
@@ -579,7 +579,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'klauge'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'fork'
event.repo.username.should == 'klauge'
event.repo.name.should == 'aeon'
@@ -596,7 +596,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'jpablobr'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'watch'
event.repo.username.should == 'bogolisk'
event.repo.name.should == 'egg'
@@ -612,7 +612,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'pengwynn'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'follow'
event.repo.should == nil
event.target_user.should == 'swistak'
@@ -628,7 +628,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'pengwynn'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'issue'
event.repo.name.should == 'twitter'
event.action.should == 'closed'
@@ -645,7 +645,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'pengwynn'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'gist'
event.repo.should == nil
event.gist_number.should == 253987
@@ -656,14 +656,14 @@ class OctopussyTest < Test::Unit::TestCase
:id => 'tag:github.com,2008:MemberEvent/110645788',
:published => '2009-12-12T11:24:14-08:00',
:updated => '2009-12-12T11:24:14-08:00',
- :links => ['http://github.com/pengwynn/octopussy'],
- :title => 'pengwynn added adamstac to octopussy',
+ :links => ['http://github.com/pengwynn/octokit'],
+ :title => 'pengwynn added adamstac to octokit',
:author => 'pengwynn'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'member'
- event.repo.name.should == 'octopussy'
+ event.repo.name.should == 'octokit'
event.target_user.should == 'adamstac'
end
@@ -677,7 +677,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'pengwynn'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'fork_apply'
event.repo.name.should == 'linkedin'
event.branch.should == 'integration'
@@ -693,7 +693,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'dxw'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'wiki'
event.repo.name.should == 'Fammel'
event.page.should == 'documentation'
@@ -709,7 +709,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'defunkt'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'comment'
event.repo.name.should == 'resque'
end
@@ -724,7 +724,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'jinzhu'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'delete'
event.repo.name.should == 'vimlike-smooziee'
event.branch.should == 'search'
@@ -740,7 +740,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'intalio'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'public'
event.repo.name.should == 'bpmn2'
end
@@ -755,7 +755,7 @@ class OctopussyTest < Test::Unit::TestCase
:author => 'tobie'
})
- event = Octopussy::Event.load_from_atom(entry)
+ event = Octokit::Event.load_from_atom(entry)
event.event_type.should == 'download'
event.repo.name.should == 'prototype'
end
View
6 test/repository_test.rb
@@ -3,7 +3,7 @@
class RepoTest < Test::Unit::TestCase
context "when passed a string containg a forward slash" do
setup do
- @repo = Octopussy::Repository.new("pengwynn/linkedin")
+ @repo = Octokit::Repository.new("pengwynn/linkedin")
end
should "set the username and repo name" do
@@ -29,7 +29,7 @@ class RepoTest < Test::Unit::TestCase
context "when passed a hash" do
should "should set username and repo" do
- repo = Octopussy::Repository.new({:username => 'pengwynn', :name => 'linkedin'})
+ repo = Octokit::Repository.new({:username => 'pengwynn', :name => 'linkedin'})
repo.name.should == "linkedin"
repo.username.should == "pengwynn"
end
@@ -37,7 +37,7 @@ class RepoTest < Test::Unit::TestCase
context "when passed a Repo" do
should "set username and repo" do
- repo = Octopussy::Repository.new(Octopussy::Repository.new('pengwynn/linkedin'))
+ repo = Octokit::Repository.new(Octokit::Repository.new('pengwynn/linkedin'))
repo.name.should == "linkedin"
repo.username.should == "pengwynn"
end
Please sign in to comment.
Something went wrong with that request. Please try again.