Class: SakuraCloud

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

Defined Under Namespace

Classes: Server

Constant Summary collapse

VERSION =
'0.0.1'
API_URL_BASE =
'https://secure.sakura.ad.jp/cloud/api/cloud/0.2'

Instance Method Summary collapse

Constructor Details

#initialize(api_key, api_secret) ⇒ SakuraCloud

Returns a new instance of SakuraCloud.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sakura_cloud.rb', line 8

def initialize(api_key, api_secret)
  @api_key=api_key
  @api_secret=api_secret
  api_uri=URI.parse(API_URL_BASE)
  @api_server=Net::HTTP.new(api_uri.host,api_uri.port)
  Net::HTTP.version_1_2
  if api_uri.scheme=="https"
    @api_server.use_ssl=true 
    @api_server.verify_mode = OpenSSL::SSL::VERIFY_NONE
  end
end

Instance Method Details

#server(server_id) ⇒ Object



107
108
109
# File 'lib/sakura_cloud.rb', line 107

def server(server_id)
  Server.new(@api_key,@api_secret,@api_server,server_id)
end