Class: Cascaad::Client
- Inherits:
-
Object
- Object
- Cascaad::Client
- Defined in:
- lib/cascaad.rb
Constant Summary collapse
- BASE_URL =
'http://openapi.cascaad.com/1/supertweet'
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
21 22 23 |
# File 'lib/cascaad.rb', line 21 def api_key @api_key end |
Instance Method Details
#from(domain) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/cascaad.rb', line 37 def from(domain) raise BadRequest if @command.empty? raise UnsupportedDomain unless domain == 'twitter.com' begin open(api_url_for(domain)) do |response| JSON.parse(response.read) end rescue OpenURI::HTTPError raise Cascaad::BadApiKey end end |
#related_messages(*ids) ⇒ Object
32 33 34 35 |
# File 'lib/cascaad.rb', line 32 def (*ids) ids.valid_ids_required Client.new(@api_key, "related", ids) end |
#show_messages(*ids) ⇒ Object
27 28 29 30 |
# File 'lib/cascaad.rb', line 27 def (*ids) ids.valid_ids_required Client.new(@api_key, "show", ids) end |