Class: RSperantito::Base
- Inherits:
-
Object
show all
- Defined in:
- lib/rsperantito/base.rb
Class Method Summary
collapse
Class Method Details
.find(id, type) ⇒ Object
3
4
5
6
7
|
# File 'lib/rsperantito/base.rb', line 3
def self.find(id, type)
url = "#{type}s/#{id}"
response = RSperantito.get(url)
response[type]
end
|
.list(page = 1, type, **options) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/rsperantito/base.rb', line 9
def self.list(page=1, type, **options)
url = "#{type}s?page=#{page}"
options.each do |option, value|
url << "&#{option}=#{value}"
end
response = RSperantito.get(url)
response["#{type}s"]
end
|
.search(query, type, page = 1) ⇒ Object
19
20
21
22
23
24
|
# File 'lib/rsperantito/base.rb', line 19
def self.search(query, type, page=1)
url = "#{type}s?q=#{query}"
response = RSperantito.get(url)
response["#{type}s"][0]
end
|