Class: Ghee
- Inherits:
-
Object
show all
- 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
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from API::Orgs
#orgs, #team
Methods included from API::Repos
#repos
#events
Methods included from API::Users
#user, #users
Methods included from API::Gists
#gists
#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(options = {}, &block)
@options = options
@block = block if block
return @connection = Ghee::Connection.new(options, &block)
end
|
Instance Attribute Details
#connection ⇒ Object
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)
options = { :access_token => token }
options[:api_url] = api_url if api_url
Ghee.new options
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)
options = { :basic_auth => {:user_name => user_name, :password => password} }
options[:api_url] = api_url if api_url
Ghee.new options
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).authorizations.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
|
#search ⇒ Object
37
38
39
|
# File 'lib/ghee/api/search.rb', line 37
def search
API::Search::Proxy.new(connection,"")
end
|