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/members.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,
lib/ghee/api/commit_comments.rb,
lib/ghee/api/commit_statuses.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.15.23"
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
48 49 50 51 52 |
# File 'lib/ghee.rb', line 48 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.
34 35 36 |
# File 'lib/ghee.rb', line 34 def connection @connection end |
Class Method Details
.access_token(token, api_url = nil) ⇒ Object
68 69 70 71 72 |
# File 'lib/ghee.rb', line 68 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
62 63 64 65 66 |
# File 'lib/ghee.rb', line 62 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
74 75 76 77 78 |
# File 'lib/ghee.rb', line 74 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
54 55 56 57 58 59 60 |
# File 'lib/ghee.rb', line 54 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 |