Class: BreakingBad::MethodsRequest
- Inherits:
-
Object
- Object
- BreakingBad::MethodsRequest
show all
- Defined in:
- lib/breaking_bad/methods_request.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of MethodsRequest.
5
6
7
|
# File 'lib/breaking_bad/methods_request.rb', line 5
def initialize
@client = BreakingBad::Client.new("https://www.breakingbadapi.com/api/")
end
|
Instance Method Details
#all ⇒ Object
9
10
11
12
13
|
# File 'lib/breaking_bad/methods_request.rb', line 9
def all
threads = []
threads << Thread.new { client.get(endpoint_name("s").to_s) }
threads.map(&:value)
end
|
#find(id) ⇒ Object
15
16
17
|
# File 'lib/breaking_bad/methods_request.rb', line 15
def find(id)
client.get("#{endpoint_name("s")}/#{id}")
end
|
#random(*author) ⇒ Object
19
20
21
|
# File 'lib/breaking_bad/methods_request.rb', line 19
def random(*author)
client.get("#{endpoint_name("s")}/random/#{author}")
end
|