Class: Fillerama::Client
- Inherits:
-
Object
- Object
- Fillerama::Client
- Defined in:
- lib/fillerama/client.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Client
constructor
A new instance of Client.
- #quotes ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Client
Returns a new instance of Client.
5 6 7 8 |
# File 'lib/fillerama/client.rb', line 5 def initialize(opts={}) @source = opts[:source] @count = opts[:count] || 1 end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
3 4 5 |
# File 'lib/fillerama/client.rb', line 3 def count @count end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
3 4 5 |
# File 'lib/fillerama/client.rb', line 3 def source @source end |
Instance Method Details
#quotes ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/fillerama/client.rb', line 10 def quotes data = JSON.parse(RestClient.get 'http://api.chrisvalleskey.com/fillerama/get.php', params) quotes = data['db'].map {|e| e['quote']} coder = HTMLEntities.new CGI.unescapeHTML(coder.decode(quotes.join(' '))) end |