Class: KSequencing::Connection
- Inherits:
-
Object
- Object
- KSequencing::Connection
- Defined in:
- lib/k_sequencing/connection.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#get(path, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/k_sequencing/connection.rb', line 7 def get(path, = {}) @response = connection.get do |request| request.url(path) request.headers['Content-Type'] = 'application/json' request.headers['Authorization'] = [:token] unless [:token].nil? request.params = [:path_param] ? () : end Response.new(data, status_code, , , total) rescue Error, Faraday::Error => e handle_error(e) end |
#post(path, options = {}, query_params = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/k_sequencing/connection.rb', line 19 def post(path, = {}, query_params = {}) @response = connection.post do |request| request.path = path request.headers['Content-Type'] = 'application/json' request.headers['Authorization'] = [:token] unless [:token].nil? request.params = query_params request.body = unless .nil? end Response.new(data, status_code, , , nil) rescue Error, Faraday::Error => e handle_error(e) end |