Class: Ghee

Inherits:
Object
  • Object
show all
Includes:
API::Authorizations, API::Events, API::Gists, API::Issues, API::Milestones, API::Orgs, API::Repos, API::Users
Defined in:
lib/ghee.rb,
lib/ghee/version.rb,
lib/ghee/api/orgs.rb,
lib/ghee/api/gists.rb,
lib/ghee/api/repos.rb,
lib/ghee/api/users.rb,
lib/ghee/api/events.rb,
lib/ghee/api/issues.rb,
lib/ghee/connection.rb,
lib/ghee/api/git_data.rb,
lib/ghee/api/downloads.rb,
lib/ghee/state_methods.rb,
lib/ghee/api/milestones.rb,
lib/ghee/resource_proxy.rb,
lib/ghee/api/authorizations.rb

Defined Under Namespace

Modules: API, CUD Classes: Connection, ResourceProxy

Constant Summary collapse

VERSION =
"0.8.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



34
35
36
# File 'lib/ghee.rb', line 34

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

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



18
19
20
# File 'lib/ghee.rb', line 18

def connection
  @connection
end

Class Method Details

.access_token(token) ⇒ Object



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

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

.basic_auth(user_name, password) ⇒ Object



38
39
40
# File 'lib/ghee.rb', line 38

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



46
47
48
49
50
# File 'lib/ghee.rb', line 46

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