Class: Fillerama::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/fillerama/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#countObject (readonly)

Returns the value of attribute count.



3
4
5
# File 'lib/fillerama/client.rb', line 3

def count
  @count
end

#sourceObject (readonly)

Returns the value of attribute source.



3
4
5
# File 'lib/fillerama/client.rb', line 3

def source
  @source
end

Instance Method Details

#quotesObject



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