Class: Lce::Quote

Inherits:
Hashie::Mash
  • Object
show all
Includes:
Hashie::Extensions::Coercion
Defined in:
lib/lce/quote.rb

Class Method Summary collapse

Class Method Details

.all(page = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/lce/quote.rb', line 16

def all(page = nil)
  if page
    page = 1 if page <= 0
    options = {page: page}
  end
  response = Lce.client.get('quotes', nil, nil, nil , options)
  response.map! do |q|
    new(q)
  end        
end

.find(id) ⇒ Object



27
28
29
30
# File 'lib/lce/quote.rb', line 27

def find(id)
  response = Lce.client.get('quotes', id)
  new(response)
end

.request(params) ⇒ Object



11
12
13
14
# File 'lib/lce/quote.rb', line 11

def request(params)
  response = Lce.client.post('quotes', {quote: params})
  new(response)
end