fog-voxel 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a19d8f5594b74ab6b49e07a6b79c41d2a8eacd6d
4
- data.tar.gz: 4fe19fd27aaaa5b2b4db8cb551fd293890cb381a
3
+ metadata.gz: 85c43d9083f16f906a26dc8e7c8e3a4d4dcca878
4
+ data.tar.gz: 7ea00919d83478c031bd2a41fa29f4efe68acaef
5
5
  SHA512:
6
- metadata.gz: ebd720c5266b294748bfa814d394a881c05fc962c411c5af48e0d767b6b6b01fcf81a341d5b226854b7810be1c74db10fb608abbf33b2b32cce70e6dca51bd81
7
- data.tar.gz: 12e25cc674d4a98518007d8492caedd067fc25967a83e1df45775e99a67a54f5e5a1856ef332ecd4da1e196e36badccf912f84dfdb62d6bef1bed3ebd075dac6
6
+ metadata.gz: 1ab3144dd07a4487950fec7433b12c29d92775c8d7836fa603d155f5b534494b1d29eb17e9b1e5cb6119a3e4135397163a5fee3d29fb7997a25ecf5367c833e3
7
+ data.tar.gz: 8765940e85eeb569c60a1304867fb4dafce14ab30b1d7ed09cabf3f6276ea4085c14f7172754be3e57cc7ae8d25037efc56bb71b09738e1dbf73ba920ae95a18
@@ -18,3 +18,6 @@ Style/SignalException:
18
18
 
19
19
  Style/StringLiterals:
20
20
  EnforcedStyle: double_quotes
21
+
22
+ Style/ExtraSpacing:
23
+ Enabled: false
@@ -14,7 +14,10 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = ""
15
15
  spec.license = "MIT"
16
16
 
17
- spec.files = `git ls-files -z`.split("\x0")
17
+ files = `git ls-files -z`.split("\x0")
18
+ files.delete(".hound.yml")
19
+ spec.files = files
20
+
18
21
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
23
  spec.require_paths = ["lib"]
@@ -14,7 +14,7 @@ class Voxel < Fog::Bin
14
14
  hash[key] = case key
15
15
  when :compute
16
16
  Fog::Logger.warning("Voxel[:compute] is not recommended, use Compute[:voxel] for portability")
17
- Fog::Compute.new(:provider => 'Voxel')
17
+ Fog::Compute.new(:provider => "Voxel")
18
18
  else
19
19
  raise ArgumentError, "Unrecognized service: #{key.inspect}"
20
20
  end
@@ -1,23 +1,21 @@
1
- require 'fog/voxel'
2
-
3
1
  module Fog
4
2
  module Compute
5
3
  class Voxel < Fog::Service
6
- autoload :Image, 'fog/compute/voxel/image'
7
- autoload :Images, 'fog/compute/voxel/images'
8
- autoload :Server, 'fog/compute/voxel/server'
9
- autoload :Servers, 'fog/compute/voxel/servers'
4
+ autoload :Image, File.expand_path("../voxel/models/image", __FILE__)
5
+ autoload :Images, File.expand_path("../voxel/models/images", __FILE__)
6
+ autoload :Server, File.expand_path("../voxel/models/server", __FILE__)
7
+ autoload :Servers, File.expand_path("../voxel/models/servers", __FILE__)
10
8
 
11
9
  requires :voxel_api_key, :voxel_api_secret
12
10
  recognizes :host, :port, :scheme, :persistent
13
11
 
14
- model_path 'fog/compute/voxel'
12
+ model_path "fog/compute/voxel/models"
15
13
  model :image
16
14
  collection :images
17
15
  model :server
18
16
  collection :servers
19
17
 
20
- request_path 'fog/compute/voxel/real'
18
+ request_path "fog/compute/voxel/requests"
21
19
  request :images_list
22
20
  request :devices_list
23
21
  request :devices_power
@@ -35,21 +33,22 @@ module Fog
35
33
  :servers => [],
36
34
  :statuses => {},
37
35
  :images => [
38
- {'id' => 1, 'name' => "CentOS 4, 32-bit, base install"},
39
- {'id' => 2, 'name' => "CentOS 4, 64-bit, base install"},
40
- {'id' => 3, 'name' => "CentOS 5, 32-bit, base install"},
41
- {'id' => 4, 'name' => "CentOS 5, 64-bit, base install"},
42
- {'id' => 7, 'name' => "Fedora 10, 32-bit, base install"},
43
- {'id' => 8, 'name' => "Fedora 10, 64-bit, base install"},
44
- {'id' => 10, 'name' => "OpenSUSE 11, 64-bit, base install"},
45
- {'id' => 11, 'name' => "Debian 5.0 \"lenny\", 32-bit, base install"},
46
- {'id' => 12, 'name' => "Debian 5.0 \"lenny\", 64-bit, base install"},
47
- {'id' => 13, 'name' => "Ubuntu 8.04 \"Hardy\", 32-bit, base install"},
48
- {'id' => 14, 'name' => "Ubuntu 8.04 \"Hardy\", 64-bit, base install"},
49
- {'id' => 15, 'name' => "Voxel Server Environment (VSE), 32-bit, base install"},
50
- {'id' => 16, 'name' => "Voxel Server Environment (VSE), 64-bit, base install"},
51
- {'id' => 32, 'name' => "Pantheon Official Mercury Stack for Drupal (based on VSE/64)"},
52
- {'id' => 55, 'name' => "Ubuntu 10.04 \"Lucid\", 64-bit, base install"} ]
36
+ { "id" => 1, "name" => "CentOS 4, 32-bit, base install" },
37
+ { "id" => 2, "name" => "CentOS 4, 64-bit, base install" },
38
+ { "id" => 3, "name" => "CentOS 5, 32-bit, base install" },
39
+ { "id" => 4, "name" => "CentOS 5, 64-bit, base install" },
40
+ { "id" => 7, "name" => "Fedora 10, 32-bit, base install" },
41
+ { "id" => 8, "name" => "Fedora 10, 64-bit, base install" },
42
+ { "id" => 10, "name" => "OpenSUSE 11, 64-bit, base install" },
43
+ { "id" => 11, "name" => "Debian 5.0 \"lenny\", 32-bit, base install" },
44
+ { "id" => 12, "name" => "Debian 5.0 \"lenny\", 64-bit, base install" },
45
+ { "id" => 13, "name" => "Ubuntu 8.04 \"Hardy\", 32-bit, base install" },
46
+ { "id" => 14, "name" => "Ubuntu 8.04 \"Hardy\", 64-bit, base install" },
47
+ { "id" => 15, "name" => "Voxel Server Environment (VSE), 32-bit, base install" },
48
+ { "id" => 16, "name" => "Voxel Server Environment (VSE), 64-bit, base install" },
49
+ { "id" => 32, "name" => "Pantheon Official Mercury Stack for Drupal (based on VSE/64)" },
50
+ { "id" => 55, "name" => "Ubuntu 10.04 \"Lucid\", 64-bit, base install" }
51
+ ]
53
52
  }
54
53
  end
55
54
  end
@@ -75,8 +74,8 @@ module Fog
75
74
  include Collections
76
75
 
77
76
  def initialize(options = {})
78
- require 'time'
79
- require 'digest/md5'
77
+ require "time"
78
+ require "digest/md5"
80
79
 
81
80
  @voxel_api_key = options[:voxel_api_key]
82
81
  @voxel_api_secret = options[:voxel_api_secret]
@@ -84,7 +83,7 @@ module Fog
84
83
  @connection_options = options[:connection_options] || {}
85
84
  @host = options[:host] || "api.voxel.net"
86
85
  @port = options[:port] || 443
87
- @scheme = options[:scheme] || 'https'
86
+ @scheme = options[:scheme] || "https"
88
87
  @persistent = options[:persistent] || false
89
88
 
90
89
  @connection_options[:ssl_verify_peer] = false
@@ -103,7 +102,7 @@ module Fog
103
102
  :parser => parser,
104
103
  :path => "/version/1.0/"
105
104
  )
106
- unless data.body['stat'] == 'ok'
105
+ unless data.body["stat"] == "ok"
107
106
  raise Fog::Compute::Voxel::Error, "#{data.body['err']['msg']}"
108
107
  end
109
108
  data
@@ -5,12 +5,12 @@ module Fog
5
5
  model Fog::Compute::Voxel::Image
6
6
 
7
7
  def all
8
- data = service.images_list.body['images']
8
+ data = service.images_list.body["images"]
9
9
  load(data)
10
10
  end
11
11
 
12
12
  def get(image_id)
13
- data = service.images_list(image_id).body['images']
13
+ data = service.images_list(image_id).body["images"]
14
14
 
15
15
  if data.empty?
16
16
  nil
@@ -9,10 +9,10 @@ module Fog
9
9
  attribute :image_id
10
10
  attribute :facility
11
11
  attribute :disk_size
12
- attribute :ip_assignments, :aliases => 'ipassignments'
12
+ attribute :ip_assignments, :aliases => "ipassignments"
13
13
 
14
14
  def initialize(attributes={})
15
- self.image_id ||= '55' # Ubuntu 10.04 LTS 64bit
15
+ self.image_id ||= "55" # Ubuntu 10.04 LTS 64bit
16
16
  super
17
17
  end
18
18
 
@@ -28,15 +28,15 @@ module Fog
28
28
  end
29
29
 
30
30
  def ready?
31
- self.state == 'SUCCEEDED'
31
+ state == "SUCCEEDED"
32
32
  end
33
33
 
34
34
  def private_ip_address
35
- ip_assignments.select {|ip_assignment| ip_assignment['type'] == 'internal'}.first
35
+ ip_assignments.select { |ip_assignment| ip_assignment["type"] == "internal" }.first
36
36
  end
37
37
 
38
38
  def public_ip_address
39
- ip_assignments.select {|ip_assignment| ip_assignment['type'] == 'external'}.first
39
+ ip_assignments.select { |ip_assignment| ip_assignment["type"] == "external" }.first
40
40
  end
41
41
 
42
42
  def reboot
@@ -46,11 +46,11 @@ module Fog
46
46
  end
47
47
 
48
48
  def state
49
- @state ||= service.voxcloud_status(id).body['devices'].first['status']
49
+ @state ||= service.voxcloud_status(id).body["devices"].first["status"]
50
50
  end
51
51
 
52
52
  def save
53
- raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
53
+ raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
54
54
  requires :name, :image_id, :processing_cores, :facility, :disk_size
55
55
 
56
56
  data = service.voxcloud_create({
@@ -61,7 +61,7 @@ module Fog
61
61
  :processing_cores => processing_cores
62
62
  }).body
63
63
 
64
- merge_attributes(data['device'])
64
+ merge_attributes(data["device"])
65
65
 
66
66
  true
67
67
  end
@@ -5,12 +5,12 @@ module Fog
5
5
  model Fog::Compute::Voxel::Server
6
6
 
7
7
  def all
8
- data = service.devices_list.body['devices'].select {|device| device['type']['id'] == '3'}
8
+ data = service.devices_list.body["devices"].select { |device| device["type"]["id"] == "3" }
9
9
  load(data)
10
10
  end
11
11
 
12
12
  def get(device_id)
13
- if device_id && server = service.devices_list(device_id).body['devices']
13
+ if device_id && server = service.devices_list(device_id).body["devices"]
14
14
  new(server.first)
15
15
  end
16
16
  rescue Fog::Service::Error => error
@@ -2,12 +2,10 @@ module Fog
2
2
  module Compute
3
3
  class Voxel
4
4
  class Real
5
- require 'fog/voxel/parsers/voxel/devices_list'
6
-
7
5
  def devices_list(device_id = nil)
8
6
  options = {
9
7
  :parser => Fog::Parsers::Compute::Voxel::DevicesList.new,
10
- :verbosity => 'normal'
8
+ :verbosity => "normal"
11
9
  }
12
10
 
13
11
  unless device_id.nil?
@@ -2,14 +2,12 @@ module Fog
2
2
  module Compute
3
3
  class Voxel
4
4
  class Real
5
- require 'fog/voxel/parsers/voxel/basic'
6
-
7
5
  def devices_power(device_id, power_action)
8
6
  options = {
9
7
  :device_id => device_id,
10
8
  :parser => Fog::Parsers::Compute::Voxel::Basic.new,
11
9
  :power_action => power_action,
12
- :verbosity => 'normal'
10
+ :verbosity => "normal"
13
11
  }
14
12
 
15
13
  request("voxel.devices.power", options)
@@ -2,22 +2,20 @@ module Fog
2
2
  module Compute
3
3
  class Voxel
4
4
  class Real
5
- require 'fog/voxel/parsers/voxel/images_list'
6
-
7
5
  def images_list(image_id = nil)
8
6
  options = {
9
7
  :parser => Fog::Parsers::Compute::Voxel::ImagesList.new,
10
- :verbosity => 'compact'
8
+ :verbosity => "compact"
11
9
  }
12
10
 
13
11
  unless image_id.nil?
14
- options[:verbosity] = 'extended'
12
+ options[:verbosity] = "extended"
15
13
  options[:image_id] = image_id
16
14
  end
17
15
 
18
16
  data = request("voxel.images.list", options)
19
17
 
20
- if data.body['stat'] == "ok"
18
+ if data.body["stat"] == "ok"
21
19
  data
22
20
  else
23
21
  raise Fog::Compute::Voxel::NotFound
@@ -2,8 +2,6 @@ module Fog
2
2
  module Compute
3
3
  class Voxel
4
4
  class Real
5
- require 'fog/voxel/parsers/voxel/voxcloud_create'
6
-
7
5
  def voxcloud_create(options)
8
6
  options[:parser] = Fog::Parsers::Compute::Voxel::VoxcloudCreate.new
9
7
 
@@ -2,8 +2,6 @@ module Fog
2
2
  module Compute
3
3
  class Voxel
4
4
  class Real
5
- require 'fog/voxel/parsers/voxel/voxcloud_delete'
6
-
7
5
  def voxcloud_delete(device_id)
8
6
  options = {
9
7
  :device_id => device_id,
@@ -2,12 +2,10 @@ module Fog
2
2
  module Compute
3
3
  class Voxel
4
4
  class Real
5
- require 'fog/voxel/parsers/voxel/voxcloud_status'
6
-
7
5
  def voxcloud_status(device_id = nil)
8
6
  options = {
9
7
  :parser => Fog::Parsers::Compute::Voxel::VoxcloudStatus.new,
10
- :verbosity => 'compact'
8
+ :verbosity => "compact"
11
9
  }
12
10
 
13
11
  unless device_id.nil?
@@ -1,7 +1,7 @@
1
1
  module Fog
2
2
  module Parsers
3
3
  module Compute
4
- autoload :Voxel, 'fog/parsers/compute/voxel'
4
+ autoload :Voxel, "fog/parsers/compute/voxel"
5
5
  end
6
6
  end
7
7
  end
@@ -2,12 +2,12 @@ module Fog
2
2
  module Parsers
3
3
  module Compute
4
4
  module Voxel
5
- autoload :Basic, 'fog/parsers/compute/voxel/basic'
6
- autoload :DevicesList, 'fog/parsers/compute/voxel/devices_list'
7
- autoload :ImagesList, 'fog/parsers/compute/voxel/images_list'
8
- autoload :VoxcloudCreate, 'fog/parsers/compute/voxel/voxcloud_create'
9
- autoload :VoxcloudDelete, 'fog/parsers/compute/voxel/voxcloud_delete'
10
- autoload :Voxcloudstatus, 'fog/parsers/compute/voxel/voxcloud_status'
5
+ autoload :Basic, "fog/parsers/compute/voxel/basic"
6
+ autoload :DevicesList, "fog/parsers/compute/voxel/devices_list"
7
+ autoload :ImagesList, "fog/parsers/compute/voxel/images_list"
8
+ autoload :VoxcloudCreate, "fog/parsers/compute/voxel/voxcloud_create"
9
+ autoload :VoxcloudDelete, "fog/parsers/compute/voxel/voxcloud_delete"
10
+ autoload :Voxcloudstatus, "fog/parsers/compute/voxel/voxcloud_status"
11
11
  end
12
12
  end
13
13
  end
@@ -11,13 +11,13 @@ module Fog
11
11
  super
12
12
 
13
13
  case name
14
- when 'err'
15
- @response['err'] = {
16
- 'code' => attr_value('code', attrs),
17
- 'msg' => attr_value('msg', attrs)
14
+ when "err"
15
+ @response["err"] = {
16
+ "code" => attr_value("code", attrs),
17
+ "msg" => attr_value("msg", attrs)
18
18
  }
19
- when 'rsp'
20
- @response['stat'] = attr_value('stat', attrs)
19
+ when "rsp"
20
+ @response["stat"] = attr_value("stat", attrs)
21
21
  end
22
22
  end
23
23
  end
@@ -5,7 +5,7 @@ module Fog
5
5
  class DevicesList < Fog::Parsers::Base
6
6
  def reset
7
7
  @device = {}
8
- @response = { 'devices' => [] }
8
+ @response = { "devices" => [] }
9
9
  @in_storage = false
10
10
  end
11
11
 
@@ -13,90 +13,89 @@ module Fog
13
13
  super
14
14
 
15
15
  case name
16
- when 'accessmethod'
17
- @access_method = { 'type' => attr_value('type', attrs) }
18
- when 'accessmethods'
19
- @device['access_methods'] = []
20
- when 'device'
16
+ when "accessmethod"
17
+ @access_method = { "type" => attr_value("type", attrs) }
18
+ when "accessmethods"
19
+ @device["access_methods"] = []
20
+ when "device"
21
21
  @device = {
22
- 'id' => attr_value('id', attrs),
23
- 'label' => attr_value('label', attrs),
24
- 'status' => attr_value('status', attrs)
22
+ "id" => attr_value("id", attrs),
23
+ "label" => attr_value("label", attrs),
24
+ "status" => attr_value("status", attrs)
25
25
  }
26
- when 'err'
27
- @response['err'] = {
28
- 'code' => attr_value('code', attrs),
29
- 'msg' => attr_value('msg', attrs)
26
+ when "err"
27
+ @response["err"] = {
28
+ "code" => attr_value("code", attrs),
29
+ "msg" => attr_value("msg", attrs)
30
30
  }
31
- when 'cage', 'facility', 'rack', 'row', 'zone'
32
- @device['location'][name] = { 'id' => attr_value('id', attrs) }
33
- if code = attr_value('code', attrs)
34
- @device['location'][name]['code'] = code
31
+ when "cage", "facility", "rack", "row", "zone"
32
+ @device["location"][name] = { "id" => attr_value("id", attrs) }
33
+ if code = attr_value("code", attrs)
34
+ @device["location"][name]["code"] = code
35
35
  end
36
- when 'drive'
37
- @drive = { 'position' => attr_value('position', attrs) }
38
- when 'ipassignment'
39
- type = attr_value('type', attrs)
40
- @device['ipassignments'] = []
41
- @device['ipassignments'] << {
42
- 'id' => attr_value('id', attrs),
43
- 'type' => attr_value('type', attrs),
44
- 'description' => attr_value('description', attrs),
36
+ when "drive"
37
+ @drive = { "position" => attr_value("position", attrs) }
38
+ when "ipassignment"
39
+ @device["ipassignments"] = []
40
+ @device["ipassignments"] << {
41
+ "id" => attr_value("id", attrs),
42
+ "type" => attr_value("type", attrs),
43
+ "description" => attr_value("description", attrs),
45
44
  }
46
- when 'ipassignments'
47
- @device['ipassignments'] = {}
48
- when 'location'
49
- @device['location'] = {}
50
- when 'memory'
51
- @device['memory'] = { 'size' => attr_value('size', attrs).to_i }
52
- when 'model', 'type'
53
- @device[name] = { 'id' => attr_value('id', attrs) }
54
- when 'operating_system'
55
- @device['operating_system'] = {}
56
- when 'power_consumption'
57
- @device[name] = attr_value('unit', attrs)
58
- when 'processor'
59
- @device['processor'] = {}
60
- when 'rsp'
61
- @response['stat'] = attr_value('stat', attrs)
62
- when 'storage'
63
- @device['drives'] = []
45
+ when "ipassignments"
46
+ @device["ipassignments"] = {}
47
+ when "location"
48
+ @device["location"] = {}
49
+ when "memory"
50
+ @device["memory"] = { "size" => attr_value("size", attrs).to_i }
51
+ when "model", "type"
52
+ @device[name] = { "id" => attr_value("id", attrs) }
53
+ when "operating_system"
54
+ @device["operating_system"] = {}
55
+ when "power_consumption"
56
+ @device[name] = attr_value("unit", attrs)
57
+ when "processor"
58
+ @device["processor"] = {}
59
+ when "rsp"
60
+ @response["stat"] = attr_value("stat", attrs)
61
+ when "storage"
62
+ @device["drives"] = []
64
63
  end
65
64
  end
66
65
 
67
66
  def end_element(name)
68
67
  case name
69
- when 'access_method'
70
- @device['access_methods'] << @access_method
71
- when 'architecture'
72
- @device['operating_system'][name] = value.to_i
73
- when 'cage', 'facility', 'rack', 'row', 'zone'
74
- @device['location'][name]['value'] = value
75
- when 'cores'
76
- @device['processor'][name] = value.to_i
77
- when 'description'
68
+ when "access_method"
69
+ @device["access_methods"] << @access_method
70
+ when "architecture"
71
+ @device["operating_system"][name] = value.to_i
72
+ when "cage", "facility", "rack", "row", "zone"
73
+ @device["location"][name]["value"] = value
74
+ when "cores"
75
+ @device["processor"][name] = value.to_i
76
+ when "description"
78
77
  @device[name] = value
79
- when 'device'
80
- @response['devices'] << @device
78
+ when "device"
79
+ @response["devices"] << @device
81
80
  @device = {}
82
- when 'drive'
83
- @device['drives'] << @drive
81
+ when "drive"
82
+ @device["drives"] << @drive
84
83
  @drive = {}
85
- when 'cores'
86
- @device['processing_cores'] = value.to_i
87
- when 'ipassignment'
88
- @device['ipassignments'].last['value'] = value
89
- when 'model', 'type'
90
- @device[name]['value'] = value
91
- when 'name'
92
- @device['operating_system'][name] = value
93
- when 'position'
94
- @device['location'][name] = value
95
- when 'power_consumption'
96
- @device[name] = [value, @device[name]].join(' ')
97
- when 'size'
84
+ when "cores"
85
+ @device["processing_cores"] = value.to_i
86
+ when "ipassignment"
87
+ @device["ipassignments"].last["value"] = value
88
+ when "model", "type"
89
+ @device[name]["value"] = value
90
+ when "name"
91
+ @device["operating_system"][name] = value
92
+ when "position"
93
+ @device["location"][name] = value
94
+ when "power_consumption"
95
+ @device[name] = [value, @device[name]].join(" ")
96
+ when "size"
98
97
  @drive[name] = value.to_i
99
- when 'host', 'password', 'protocol', 'username'
98
+ when "host", "password", "protocol", "username"
100
99
  @access_method[name] = value
101
100
  end
102
101
  end
@@ -5,47 +5,47 @@ module Fog
5
5
  class ImagesList < Fog::Parsers::Base
6
6
  def reset
7
7
  @image = {}
8
- @response = { 'images' => [] }
8
+ @response = { "images" => [] }
9
9
  end
10
10
 
11
11
  def start_element(name, attrs = [])
12
12
  super
13
13
 
14
14
  case name
15
- when 'err'
16
- @response['err'] = {
17
- 'code' => attr_value('code', attrs),
18
- 'msg' => attr_value('msg', attrs)
15
+ when "err"
16
+ @response["err"] = {
17
+ "code" => attr_value("code", attrs),
18
+ "msg" => attr_value("msg", attrs)
19
19
  }
20
- when 'size'
21
- @image['filesystem']['units'] = attr_value('units', attrs)
22
- when 'image'
20
+ when "size"
21
+ @image["filesystem"]["units"] = attr_value("units", attrs)
22
+ when "image"
23
23
  @image = {
24
- 'id' => attr_value('id', attrs).to_i,
25
- 'summary' => attr_value('summary', attrs)
24
+ "id" => attr_value("id", attrs).to_i,
25
+ "summary" => attr_value("summary", attrs)
26
26
  }
27
- when 'filesystem', 'operating_system'
27
+ when "filesystem", "operating_system"
28
28
  @image[name] = {}
29
- when 'rsp'
30
- @response['stat'] = attr_value('stat', attrs)
29
+ when "rsp"
30
+ @response["stat"] = attr_value("stat", attrs)
31
31
  end
32
32
  end
33
33
 
34
34
  def end_element(name)
35
35
  case name
36
- when 'architecture'
37
- @image['operating_system'][name] = value.to_i
38
- when 'admin_username', 'family', 'product_family', 'product_version', 'version'
39
- @image['operating_system'][name] = value
40
- when 'description'
36
+ when "architecture"
37
+ @image["operating_system"][name] = value.to_i
38
+ when "admin_username", "family", "product_family", "product_version", "version"
39
+ @image["operating_system"][name] = value
40
+ when "description"
41
41
  @image[name] = value
42
- when 'image'
43
- @response['images'] << @image
42
+ when "image"
43
+ @response["images"] << @image
44
44
  @image = {}
45
- when 'size'
46
- @image['filesystem'][name] = value.to_i
47
- when 'type'
48
- @image['filesystem'][name] = value
45
+ when "size"
46
+ @image["filesystem"][name] = value.to_i
47
+ when "type"
48
+ @image["filesystem"][name] = value
49
49
  end
50
50
  end
51
51
  end
@@ -4,29 +4,29 @@ module Fog
4
4
  module Voxel
5
5
  class VoxcloudCreate < Fog::Parsers::Base
6
6
  def reset
7
- @response = { 'device' => {} }
7
+ @response = { "device" => {} }
8
8
  end
9
9
 
10
10
  def start_element(name, attrs = [])
11
11
  super
12
12
 
13
13
  case name
14
- when 'err'
15
- @response['err'] = {
16
- 'code' => attr_value('code', attrs),
17
- 'msg' => attr_value('msg', attrs)
14
+ when "err"
15
+ @response["err"] = {
16
+ "code" => attr_value("code", attrs),
17
+ "msg" => attr_value("msg", attrs)
18
18
  }
19
- when 'rsp'
20
- @response['stat'] = attr_value('stat', attrs)
19
+ when "rsp"
20
+ @response["stat"] = attr_value("stat", attrs)
21
21
  end
22
22
  end
23
23
 
24
24
  def end_element(name)
25
25
  case name
26
- when 'id'
27
- @response['device'][name] = value
28
- when 'last_update'
29
- @response['device'][name] = Time.at(value.to_i)
26
+ when "id"
27
+ @response["device"][name] = value
28
+ when "last_update"
29
+ @response["device"][name] = Time.at(value.to_i)
30
30
  end
31
31
  end
32
32
  end
@@ -11,12 +11,12 @@ module Fog
11
11
  super
12
12
 
13
13
  case name
14
- when 'rsp'
15
- @response['stat'] = attr_value('stat', attrs)
16
- when 'err'
17
- @response['err'] = {
18
- 'code' => attr_value('code', attrs),
19
- 'msg' => attr_value('msg', attrs)
14
+ when "rsp"
15
+ @response["stat"] = attr_value("stat", attrs)
16
+ when "err"
17
+ @response["err"] = {
18
+ "code" => attr_value("code", attrs),
19
+ "msg" => attr_value("msg", attrs)
20
20
  }
21
21
  end
22
22
  end
@@ -4,7 +4,7 @@ module Fog
4
4
  module Voxel
5
5
  class VoxcloudStatus < Fog::Parsers::Base
6
6
  def reset
7
- @response = { 'devices' => [] }
7
+ @response = { "devices" => [] }
8
8
  @device = {}
9
9
  end
10
10
 
@@ -12,26 +12,26 @@ module Fog
12
12
  super
13
13
 
14
14
  case name
15
- when 'rsp'
16
- @response['stat'] = attr_value('stat', attrs)
17
- when 'err'
18
- @response['err'] = {
19
- 'code' => attr_value('code', attrs),
20
- 'msg' => attr_value('msg', attrs)
15
+ when "rsp"
16
+ @response["stat"] = attr_value("stat", attrs)
17
+ when "err"
18
+ @response["err"] = {
19
+ "code" => attr_value("code", attrs),
20
+ "msg" => attr_value("msg", attrs)
21
21
  }
22
- when 'device'
22
+ when "device"
23
23
  @device = {}
24
24
  end
25
25
  end
26
26
 
27
27
  def end_element(name)
28
28
  case name
29
- when 'device'
30
- @response['devices'] << @device
29
+ when "device"
30
+ @response["devices"] << @device
31
31
  @device = {}
32
- when 'id', 'status'
32
+ when "id", "status"
33
33
  @device[name] = value
34
- when 'last_update'
34
+ when "last_update"
35
35
  @device[name] = Time.at(value.to_i)
36
36
  end
37
37
  end
@@ -1,13 +1,13 @@
1
- require 'fog/voxel/version'
2
- require 'fog/core'
3
- require 'fog/xml'
4
- require 'digest/md5'
1
+ require "fog/core"
2
+ require "fog/xml"
3
+ require "digest/md5"
4
+ require File.expand_path("../voxel/version", __FILE__)
5
5
 
6
6
  module Fog
7
7
  module Voxel
8
8
  extend Fog::Provider
9
9
 
10
- service(:compute, 'Compute')
10
+ service(:compute, "Compute")
11
11
 
12
12
  def self.create_signature(secret, options)
13
13
  to_sign = options.keys.map { |k| k.to_s }.sort.map { |k| "#{k}#{options[k.to_sym]}" }.join("")
@@ -16,10 +16,10 @@ module Fog
16
16
  end
17
17
 
18
18
  module Compute
19
- autoload :Voxel, 'fog/compute/voxel'
19
+ autoload :Voxel, File.expand_path("../compute/voxel", __FILE__)
20
20
  end
21
21
 
22
22
  module Parsers
23
- autoload :Compute, 'fog/parsers/compute'
23
+ autoload :Compute, File.expand_path("../parsers/compute", __FILE__)
24
24
  end
25
25
  end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Voxel
3
- VERSION = "0.0.2"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-voxel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Henrique Lopes Ribeiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-01 00:00:00.000000000 Z
11
+ date: 2015-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -160,17 +160,16 @@ files:
160
160
  - gemfiles/Gemfile.1.9.3+
161
161
  - lib/fog/bin/voxel.rb
162
162
  - lib/fog/compute/voxel.rb
163
- - lib/fog/compute/voxel/image.rb
164
- - lib/fog/compute/voxel/images.rb
165
- - lib/fog/compute/voxel/real.rb
166
- - lib/fog/compute/voxel/real/devices_list.rb
167
- - lib/fog/compute/voxel/real/devices_power.rb
168
- - lib/fog/compute/voxel/real/images_list.rb
169
- - lib/fog/compute/voxel/real/voxcloud_create.rb
170
- - lib/fog/compute/voxel/real/voxcloud_delete.rb
171
- - lib/fog/compute/voxel/real/voxcloud_status.rb
172
- - lib/fog/compute/voxel/server.rb
173
- - lib/fog/compute/voxel/servers.rb
163
+ - lib/fog/compute/voxel/models/image.rb
164
+ - lib/fog/compute/voxel/models/images.rb
165
+ - lib/fog/compute/voxel/models/server.rb
166
+ - lib/fog/compute/voxel/models/servers.rb
167
+ - lib/fog/compute/voxel/requests/devices_list.rb
168
+ - lib/fog/compute/voxel/requests/devices_power.rb
169
+ - lib/fog/compute/voxel/requests/images_list.rb
170
+ - lib/fog/compute/voxel/requests/voxcloud_create.rb
171
+ - lib/fog/compute/voxel/requests/voxcloud_delete.rb
172
+ - lib/fog/compute/voxel/requests/voxcloud_status.rb
174
173
  - lib/fog/parsers/compute.rb
175
174
  - lib/fog/parsers/compute/voxel.rb
176
175
  - lib/fog/parsers/compute/voxel/basic.rb
@@ -1,6 +0,0 @@
1
- require 'fog/compute/voxel/real/devices_list'
2
- require 'fog/compute/voxel/real/devices_power'
3
- require 'fog/compute/voxel/real/images_list'
4
- require 'fog/compute/voxel/real/voxcloud_create'
5
- require 'fog/compute/voxel/real/voxcloud_delete'
6
- require 'fog/compute/voxel/real/voxcloud_status'