module Locked::API::Request

generate api request

Constants

DEFAULT_HEADERS

Default headers that we add to passed ones

Public Class Methods

call(command, api_key, headers) click to toggle source
# File lib/locked/api/request.rb, line 15
def call(command, api_key, headers)
  http.request(
    Locked::API::Request::Build.call(
      command,
      headers.merge(DEFAULT_HEADERS),
      api_key
    )
  )
end
http() click to toggle source
# File lib/locked/api/request.rb, line 25
def http
  http = Net::HTTP.new(Locked.config.host, Locked.config.port)
  http.read_timeout = Locked.config.request_timeout / 1000.0
  if Locked.config.port == 443
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER
  end
  http
end