Class: Ilkbyte::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ilkbyte.rb

Direct Known Subclasses

Account, Domain, Server

Instance Method Summary collapse

Instance Method Details

#request(url = nil, param = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ilkbyte.rb', line 12

def request(url = nil, param = {})
  @query = {"access" => $option["access"],"secret" => $option["secret"]}
  param.each do |key,value|
    @query.store(key,value)
  end
  apiUrl = $baseUrl + url
  begin
    client = HTTPClient.new
    response = client.get(apiUrl,@query)
    JSON.parse(response.body)
  rescue StandardError => e  
    response = {
      "status" => false,
      "response" => nil,
      "message" => e.message
    }    
  end
end

#setOption(access, secret) ⇒ Object



9
10
11
# File 'lib/ilkbyte.rb', line 9

def setOption(access,secret)
  $option = {"access" => access,"secret" => secret}
end