Class: ActiveRecordApi::Request::Methods
Instance Attribute Summary
Attributes inherited from Connection
#cache_store, #debug, #full_url, #path, #timeout
Attributes inherited from Credentials
#email, #headers, #host, #password, #token, #token_path
Instance Method Summary
collapse
Methods inherited from Connection
#authenticated_connection, #connection, #full_url_with_params, #http_cache_options, #service_url, #strip_double_slash, #strip_trailing_slash, #symbolize_array_response, #symbolize_response
Methods inherited from Credentials
#config, #credentials, #credentials_config
Instance Method Details
#get(id:, params: {}) ⇒ Object
8
9
10
|
# File 'lib/active_record_api/request/methods.rb', line 8
def get(id:, params: {})
symbolize_response(authenticated_connection.get(full_url_with_params(id: id, params: params)).body)
end
|
#health_endpoint ⇒ Object
24
25
26
|
# File 'lib/active_record_api/request/methods.rb', line 24
def health_endpoint
'/okcomputer/all.json'
end
|
#post(payload:, params: {}) ⇒ Object
12
13
14
|
# File 'lib/active_record_api/request/methods.rb', line 12
def post(payload:, params: {})
symbolize_response(authenticated_connection.post(full_url_with_params(params: params), payload).body)
end
|
#put(id:, payload:, params: {}) ⇒ Object
16
17
18
|
# File 'lib/active_record_api/request/methods.rb', line 16
def put(id:, payload:, params: {})
symbolize_response(authenticated_connection.put(full_url_with_params(id: id, params: params), payload).body)
end
|
#query(params: {}) ⇒ Object
4
5
6
|
# File 'lib/active_record_api/request/methods.rb', line 4
def query(params: {})
symbolize_response(authenticated_connection.get("#{full_url}/", params).body)
end
|
#service_healthy? ⇒ Boolean
20
21
22
|
# File 'lib/active_record_api/request/methods.rb', line 20
def service_healthy?
authenticated_connection.get(service_url(health_endpoint)).body.dig('default', 'success')
end
|