Class: Cronjob::Requests
- Inherits:
-
Object
show all
- Defined in:
- lib/cronjob/requests/requests.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
3
4
5
|
# File 'lib/cronjob/requests/requests.rb', line 3
def response
@response
end
|
Instance Method Details
#client ⇒ Object
5
6
7
|
# File 'lib/cronjob/requests/requests.rb', line 5
def client
Client.new.conn
end
|
#execute(method, endpoint, args) ⇒ Object
15
16
17
18
19
|
# File 'lib/cronjob/requests/requests.rb', line 15
def execute(method, endpoint, args)
args[:auth_token] = Cronjob.configuration.token
data = client.send(method, endpoint, args)
parse(data.body)
end
|
#parse(data) ⇒ Object
9
10
11
12
13
|
# File 'lib/cronjob/requests/requests.rb', line 9
def parse(data)
JSON.parse(data)
rescue JSON::ParserError => e
data
end
|