Class: Ghee
- Inherits:
-
Object
- Object
- Ghee
- Includes:
- API::Authorizations, API::Events, API::Gists, API::Orgs, API::Repos, API::Users
- Defined in:
- lib/ghee.rb,
lib/ghee/errors.rb,
lib/ghee/version.rb,
lib/ghee/api/keys.rb,
lib/ghee/api/orgs.rb,
lib/ghee/api/forks.rb,
lib/ghee/api/gists.rb,
lib/ghee/api/hooks.rb,
lib/ghee/api/pulls.rb,
lib/ghee/api/repos.rb,
lib/ghee/api/users.rb,
lib/ghee/api/emails.rb,
lib/ghee/api/events.rb,
lib/ghee/api/issues.rb,
lib/ghee/api/labels.rb,
lib/ghee/api/search.rb,
lib/ghee/connection.rb,
lib/ghee/uri_escape.rb,
lib/ghee/api/commits.rb,
lib/ghee/api/contents.rb,
lib/ghee/api/git_data.rb,
lib/ghee/api/watchers.rb,
lib/ghee/api/downloads.rb,
lib/ghee/api/followers.rb,
lib/ghee/state_methods.rb,
lib/ghee/api/milestones.rb,
lib/ghee/resource_proxy.rb,
lib/ghee/api/collaborators.rb,
lib/ghee/api/authorizations.rb
Defined Under Namespace
Modules: API, CUD, Middleware Classes: BadGateway, BadRequest, Connection, Error, Forbidden, InternalServerError, NotAcceptable, NotFound, NotImplemented, ResourceProxy, ServiceUnavailable, Unauthorized, UnprocessableEntity
Constant Summary collapse
- VERSION =
"0.12.16"
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Class Method Summary collapse
- .access_token(token, api_url = nil) ⇒ Object
- .basic_auth(user_name, password, api_url = nil) ⇒ Object
- .create_token(user_name, password, scopes, api_url = nil) ⇒ Object
Instance Method Summary collapse
- #in_parallel(adapter = :typhoeus, &block) ⇒ Object
-
#initialize(options = {}, &block) ⇒ Ghee
constructor
Instantiates Ghee, accepts an access_token for authenticated access.
- #search ⇒ Object
Methods included from API::Orgs
Methods included from API::Repos
Methods included from API::Events
Methods included from API::Users
Methods included from API::Gists
Methods included from API::Authorizations
Constructor Details
#initialize(options = {}, &block) ⇒ Ghee
Instantiates Ghee, accepts an access_token for authenticated access
Access_token - String of the access_token
45 46 47 48 49 |
# File 'lib/ghee.rb', line 45 def initialize( = {}, &block) @options = @block = block if block return @connection = Ghee::Connection.new(, &block) end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
31 32 33 |
# File 'lib/ghee.rb', line 31 def connection @connection end |
Class Method Details
.access_token(token, api_url = nil) ⇒ Object
65 66 67 68 69 |
# File 'lib/ghee.rb', line 65 def self.access_token(token, api_url = nil) = { :access_token => token } [:api_url] = api_url if api_url Ghee.new end |
.basic_auth(user_name, password, api_url = nil) ⇒ Object
59 60 61 62 63 |
# File 'lib/ghee.rb', line 59 def self.basic_auth(user_name, password, api_url = nil) = { :basic_auth => {:user_name => user_name, :password => password} } [:api_url] = api_url if api_url Ghee.new end |
.create_token(user_name, password, scopes, api_url = nil) ⇒ Object
71 72 73 74 75 |
# File 'lib/ghee.rb', line 71 def self.create_token(user_name, password, scopes, api_url = nil) auth = Ghee.basic_auth(user_name, password, api_url)..create({ :scopes => scopes}) auth["token"] end |
Instance Method Details
#in_parallel(adapter = :typhoeus, &block) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/ghee.rb', line 51 def in_parallel(adapter = :typhoeus, &block) ghee = self.class.new @options, &@block ghee.connection.adapter adapter ghee.connection.in_parallel do block.call ghee end end |