Class: GreenGoose::Client

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/greengoose/client.rb

Overview

Green Goose API client

Constant Summary collapse

API_URL =
"http://api.greengoose.com"
API_VERSION =
1

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClient

Creates a new API client



18
19
# File 'lib/greengoose/client.rb', line 18

def initialize
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



12
13
14
# File 'lib/greengoose/client.rb', line 12

def credentials
  @credentials
end

Instance Method Details

#actionsObject



32
33
34
# File 'lib/greengoose/client.rb', line 32

def actions
  GreenGoose::ActionCollection.new(self)
end

#authenticate(username, password) ⇒ Object

Authenticates against the API using a username and password

Parameters:

  • username (String)

    API Username

  • password (String)

    API Password



25
26
27
28
29
30
# File 'lib/greengoose/client.rb', line 25

def authenticate(username, password)
  @credentials = Credentials::Basic.new(username, password)
  @credentials.configure_connection(connection)

  self
end

#statsObject



36
37
38
# File 'lib/greengoose/client.rb', line 36

def stats
  GreenGoose::StatCollection.new(self)
end