Class: ActiveRecordApi::Request::Methods

Inherits:
Connection show all
Defined in:
lib/active_record_api/request/methods.rb

Instance Attribute Summary

Attributes inherited from Connection

#cache_store, #debug, #full_url, #path

Attributes inherited from Credentials

#email, #host, #password, #token

Instance Method Summary collapse

Methods inherited from Connection

#authenticated_connection, #connection, #full_url_with_params, #http_cache_options, #strip_trailing_slash, #symbolize_response

Methods inherited from Credentials

#config, #credentials, #headers, #token_path

Instance Method Details

#get(id:) ⇒ Object



8
9
10
# File 'lib/active_record_api/request/methods.rb', line 8

def get(id:)
  symbolize_response(authenticated_connection.get("#{full_url}/#{id}").body)
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