Module: Orkut::Client::Comments
Constant Summary
Constants included from Base
Base::DEFAULT_COUNT, Base::DEFAULT_DATETIME_FORMAT, Base::DEFAULT_LANGUAGE
Instance Method Summary collapse
-
#get_comments(options = {}) ⇒ Object
TODO implements features.
- #insert_comment(options = {}) ⇒ Object
Methods included from Base
#default_headers, #format_datetime, #get_refresh_token, #request_id
Instance Method Details
#get_comments(options = {}) ⇒ Object
TODO implements features
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/orkut/client/comments.rb', line 16 def get_comments(={}) raise(Orkut::Error, 'Parameter activity_id cannot be nil') if [:activity_id].blank? params = { Orkut::Constants::Fields::USER_ID => Orkut::Constants::InternalConstants::USERID_ME_SIMPLE, Orkut::Constants::Fields::ALT => Orkut::Constants::Params::JSON, Orkut::Constants::Fields::ACTIVITY_ID => [:activity_id], Orkut::Constants::Fields::MAX_RESULTS => ([:count] || Orkut::Client::Base::DEFAULT_COUNT).to_s, Orkut::Constants::Fields::EXTRA_PARAMS => } unless [:page_token].blank? params[Orkut::Constants::Fields::PAGE_TOKEN] = [:page_token] end MultiJson.decode(execute(Orkut::Constants::Fields::COMMENTS, Orkut::Constants::Action::LIST, params)) end |
#insert_comment(options = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/orkut/client/comments.rb', line 31 def insert_comment(={}) raise(Orkut::Error, 'Parameters activity_id and content cannot be nil') if [:activity_id].blank? or [:content].blank? params = { Orkut::Constants::Fields::USER_ID => Orkut::Constants::InternalConstants::USERID_ME_SIMPLE, Orkut::Constants::Fields::ALT => Orkut::Constants::Params::JSON, Orkut::Constants::Fields::ACTIVITY_ID => [:activity_id], Orkut::Constants::Fields::EXTRA_PARAMS => } body = { Orkut::Constants::Fields::CONTENT => [:content] }.to_json MultiJson.decode(execute(Orkut::Constants::Fields::COMMENTS, Orkut::Constants::Action::INSERT, params, body.to_s, default_headers)) end |