Class: Hydrogen::Base

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Base.



8
9
10
11
12
# File 'lib/hydrogen/base.rb', line 8

def initialize(, username='', password='', options={})
  @options = options
  base_uri = "http#{'s' if options[:ssl]}://#{account}.hydrogenapp.com"
  @request = Request.new({:base_uri => base_uri, :username => username, :password => password})
end

Instance Method Details

#comments(topic_id) ⇒ Object



27
28
29
30
# File 'lib/hydrogen/base.rb', line 27

def comments(topic_id)
  response = perform_get("/topics/#{topic_id}/comments.json")
  response['comments']
end

#topic(id) ⇒ Object



22
23
24
# File 'lib/hydrogen/base.rb', line 22

def topic(id)
  response = perform_get("/topics/#{id}.json")
end

#topics(query = {}) ⇒ Object

Options: since_id, max_id, count, page, since



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

def topics(query={})
  response = perform_get('/topics.json', :query => query)
  response['topics']
end