Class: Brocktail::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/brocktail/base.rb

Direct Known Subclasses

API::Acts

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, password, options = {}) ⇒ Base

Returns a new instance of Base.

Raises:



6
7
8
9
10
# File 'lib/brocktail/base.rb', line 6

def initialize(username, password, options = {})
  options[:ssl] = true if options[:ssl].nil?
  @credentials = Credentials.new(username, password, options[:ssl])
  raise InvalidCredentials unless credentials.valid?
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



4
5
6
# File 'lib/brocktail/base.rb', line 4

def credentials
  @credentials
end

#requestObject (readonly)

Returns the value of attribute request.



4
5
6
# File 'lib/brocktail/base.rb', line 4

def request
  @request
end

Instance Method Details

#acts(event_id) ⇒ Object



17
18
19
# File 'lib/brocktail/base.rb', line 17

def acts(event_id)
  @events ||= Brocktail::API::Acts.new(credentials, event_id)
end

#eventsObject



13
14
15
# File 'lib/brocktail/base.rb', line 13

def events
  @events ||= Brocktail::API::Events.new(credentials)
end