class HaasbotRuby::Client
Attributes
host[R]
port[R]
Public Class Methods
new(host, port)
click to toggle source
# File lib/haasbot_ruby/client.rb, line 10 def initialize(host, port) @host = host @port = port end
Private Instance Methods
get(path, query = {})
click to toggle source
# File lib/haasbot_ruby/client.rb, line 17 def get(path, query = {}) uri = URI::HTTP.build( host: host, port: port, path: path, query: URI.encode_www_form(query), scheme: :http, ) response = ::Faraday.get(uri.to_s) json = JSON.parse(response.body) if json['ErrorCode'] != 100 error_class = RequestError.error_from_code(json['ErrorCode']) raise error_class.new(response) end json['Result'] end