class Raynet::Core

Public Instance Methods

headers() click to toggle source
# File lib/raynet/core.rb, line 17
def headers
  {'X-Instance-Name' => Raynet::Config.config[:instance_name], accept: :json, content_type: :json}
end
request(params = {}) click to toggle source
# File lib/raynet/core.rb, line 4
def request(params = {})
  req = RestClient::Request.new(
      method: params[:method],
      url: "https://app.raynet.cz/api/v2/#{params[:endpoint]}",
      user: Raynet::Config.config[:user],
      password: Raynet::Config.config[:api_key],
      headers: headers,
      payload: params[:data].to_json
  ).execute

  JSON.parse(req, symbolize_keys: true)
end