Class: Hydrogen::Base
- Inherits:
-
Object
- Object
- Hydrogen::Base
- Defined in:
- lib/hydrogen/base.rb
Instance Method Summary collapse
-
#comment(topic_id, comment_id) ⇒ Object
Options:.
-
#comments(topic_id, query = {}) ⇒ Object
Options:.
-
#create_comment(topic_id, query = {}) ⇒ Object
Options: comment*, reply_to.
-
#create_topic(query = {}) ⇒ Object
Options:.
-
#delete_topic(id) ⇒ Object
Options:.
-
#initialize(account, username = '', password = '', options = {}) ⇒ Base
constructor
A new instance of Base.
-
#topic(id) ⇒ Object
Options:.
-
#topics(query = {}) ⇒ Object
Options: since_id, max_id, count, page, since.
Constructor Details
#initialize(account, username = '', password = '', options = {}) ⇒ Base
Returns a new instance of Base.
5 6 7 8 9 |
# File 'lib/hydrogen/base.rb', line 5 def initialize(account, username='', password='', ={}) = 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
#comment(topic_id, comment_id) ⇒ Object
Options:
47 48 49 50 |
# File 'lib/hydrogen/base.rb', line 47 def comment(topic_id, comment_id) response = perform_get("/topics/#{topic_id}/comments/#{comment_id}.json") response['comment'] end |
#comments(topic_id, query = {}) ⇒ Object
Options:
40 41 42 43 |
# File 'lib/hydrogen/base.rb', line 40 def comments(topic_id, query={}) response = perform_get("/topics/#{topic_id}/comments.json", query) response['comments'] end |
#create_comment(topic_id, query = {}) ⇒ Object
Options: comment*, reply_to
54 55 56 57 |
# File 'lib/hydrogen/base.rb', line 54 def create_comment(topic_id, query={}) response = perform_post("/topics/#{topic_id}/comments/create.json", query) response['comment'] end |
#create_topic(query = {}) ⇒ Object
Options:
27 28 29 30 |
# File 'lib/hydrogen/base.rb', line 27 def create_topic(query={}) response = perform_post("/topics/create.json", query) response['topic'] end |
#delete_topic(id) ⇒ Object
Options:
34 35 36 |
# File 'lib/hydrogen/base.rb', line 34 def delete_topic(id) response = perform_get("/topics/#{id}/delete.json") end |
#topic(id) ⇒ Object
Options:
20 21 22 23 |
# File 'lib/hydrogen/base.rb', line 20 def topic(id) response = perform_get("/topics/#{id}.json") response['topic'] end |
#topics(query = {}) ⇒ Object
Options: since_id, max_id, count, page, since
13 14 15 16 |
# File 'lib/hydrogen/base.rb', line 13 def topics(query={}) response = perform_get("/topics.json", query) response['topics'] end |