Module: Castle::API::Request
- Defined in:
- lib/castle/api/request.rb
Overview
this class is responsible for making requests to api
Class Method Summary collapse
Class Method Details
.build(command, headers, api_secret) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/castle/api/request.rb', line 25 def build(command, headers, api_secret) request_obj = Net::HTTP.const_get( command.method.to_s.capitalize ).new("#{Castle.config.url_prefix}/#{command.path}", headers) unless command.method == :get request_obj.body = ::Castle::Utils.replace_invalid_characters( command.data ).to_json end request_obj.basic_auth('', api_secret) request_obj end |