Class: Ghee

Inherits:
Object
  • Object
show all
Includes:
API::Authorizations, API::Events, API::Gists, API::Orgs, API::Repos, API::Users
Defined in:
lib/ghee.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/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/connection.rb,
lib/ghee/api/commits.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 Classes: Connection, ResourceProxy

Constant Summary collapse

VERSION =
"0.9.0"

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

Methods included from API::Events

#events

Methods included from API::Users

#user, #users

Methods included from API::Gists

#gists

Methods included from API::Authorizations

#authorizations

Constructor Details

#initialize(options = {}) ⇒ Ghee

Instantiates Ghee, accepts an access_token for authenticated access

Access_token - String of the access_token



41
42
43
# File 'lib/ghee.rb', line 41

def initialize(options = {})
  @connection = Ghee::Connection.new(options)
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



27
28
29
# File 'lib/ghee.rb', line 27

def connection
  @connection
end

Class Method Details

.access_token(token) ⇒ Object



49
50
51
# File 'lib/ghee.rb', line 49

def self.access_token(token)
  Ghee.new :access_token => token
end

.basic_auth(user_name, password) ⇒ Object



45
46
47
# File 'lib/ghee.rb', line 45

def self.basic_auth(user_name, password)
    Ghee.new :basic_auth  => {:user_name => user_name, :password => password}
end

.create_token(user_name, password, scopes) ⇒ Object



53
54
55
56
57
# File 'lib/ghee.rb', line 53

def self.create_token(user_name, password, scopes)
  auth = Ghee.basic_auth(user_name, password).authorizations.create({
    :scopes => scopes})
  auth["token"]
end