nephophobia 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/nephophobia.rb +32 -3
- data/lib/nephophobia/compute.rb +7 -3
- data/lib/nephophobia/credential.rb +8 -4
- data/lib/nephophobia/image.rb +14 -10
- data/lib/nephophobia/project.rb +15 -7
- data/lib/nephophobia/role.rb +6 -2
- data/lib/nephophobia/user.rb +8 -4
- data/lib/nephophobia/version.rb +1 -1
- metadata +2 -2
data/lib/nephophobia.rb
CHANGED
@@ -15,9 +15,13 @@ module Nephophobia
|
|
15
15
|
class ResponseData
|
16
16
|
attr_reader :return, :request_id
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
attr_accessor :attributes
|
19
|
+
|
20
|
+
def initialize attributes
|
21
|
+
@attributes = attributes
|
22
|
+
|
23
|
+
@request_id = attributes["requestId"]
|
24
|
+
@return = attributes["return"] == "true"
|
21
25
|
end
|
22
26
|
end
|
23
27
|
|
@@ -30,3 +34,28 @@ module Nephophobia
|
|
30
34
|
(obj.is_a? Hash) ? [obj] : obj
|
31
35
|
end
|
32
36
|
end
|
37
|
+
|
38
|
+
##
|
39
|
+
# Allow Data Classes to comply with ActiveModel.
|
40
|
+
|
41
|
+
module Nephophobia
|
42
|
+
class Rails
|
43
|
+
CLASSES = [
|
44
|
+
::Nephophobia::ComputeData,
|
45
|
+
::Nephophobia::CredentialData,
|
46
|
+
::Nephophobia::ImageData,
|
47
|
+
::Nephophobia::MemberData,
|
48
|
+
::Nephophobia::ProjectData,
|
49
|
+
::Nephophobia::RoleData,
|
50
|
+
::Nephophobia::UserData
|
51
|
+
].freeze
|
52
|
+
|
53
|
+
def self.insert
|
54
|
+
CLASSES.each do |clazz|
|
55
|
+
clazz.class_eval do
|
56
|
+
include ActiveModel::Serialization
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/nephophobia/compute.rb
CHANGED
@@ -4,9 +4,13 @@ module Nephophobia
|
|
4
4
|
attr_reader :key_name, :launch_time, :name, :owner_id, :placement
|
5
5
|
attr_reader :private_dns_name, :project_id, :public_dns_name, :state
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
attr_accessor :attributes
|
8
|
+
|
9
|
+
def initialize attributes
|
10
|
+
@attributes = attributes
|
11
|
+
|
12
|
+
@project_id = attributes['ownerId']
|
13
|
+
item = attributes['instancesSet']['item']
|
10
14
|
item = item.first if item.is_a?(Array)
|
11
15
|
@description = item['displayDescription']
|
12
16
|
@name = item['displayName']
|
@@ -2,10 +2,14 @@ module Nephophobia
|
|
2
2
|
class CredentialData
|
3
3
|
attr_reader :fingerprint, :material, :name
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
@
|
5
|
+
attr_accessor :attributes
|
6
|
+
|
7
|
+
def initialize attributes
|
8
|
+
@attributes = attributes
|
9
|
+
|
10
|
+
@material = attributes['keyMaterial']
|
11
|
+
@name = attributes['keyName']
|
12
|
+
@fingerprint = attributes['keyFingerprint']
|
9
13
|
end
|
10
14
|
end
|
11
15
|
|
data/lib/nephophobia/image.rb
CHANGED
@@ -3,16 +3,20 @@ module Nephophobia
|
|
3
3
|
attr_reader :architecture, :image_id, :image_location, :image_owner_id
|
4
4
|
attr_reader :image_type, :kernel_id, :is_public, :state
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
@
|
10
|
-
|
11
|
-
@
|
12
|
-
@
|
13
|
-
@
|
14
|
-
@
|
15
|
-
@
|
6
|
+
attr_accessor :attributes
|
7
|
+
|
8
|
+
def initialize attributes
|
9
|
+
@attributes = attributes
|
10
|
+
|
11
|
+
@architecture = attributes['architecture']
|
12
|
+
@id = attributes['id']
|
13
|
+
@image_id = attributes['imageId']
|
14
|
+
@image_location = attributes['imageLocation']
|
15
|
+
@image_owner_id = attributes['imageOwnerId']
|
16
|
+
@image_type = attributes['imageType']
|
17
|
+
@is_public = attributes['isPublic']
|
18
|
+
@kernel_id = attributes['kernelId']
|
19
|
+
@state = attributes['imageState']
|
16
20
|
end
|
17
21
|
end
|
18
22
|
|
data/lib/nephophobia/project.rb
CHANGED
@@ -2,19 +2,27 @@ module Nephophobia
|
|
2
2
|
class ProjectData
|
3
3
|
attr_reader :name, :manager_id, :description
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
@
|
9
|
-
|
5
|
+
attr_accessor :attributes
|
6
|
+
|
7
|
+
def initialize attributes
|
8
|
+
@attributes = attributes
|
9
|
+
|
10
|
+
@name = attributes['projectname']
|
11
|
+
@manager_id = attributes['projectManagerId']
|
12
|
+
@description = attributes['description']
|
13
|
+
@member = attributes['member']
|
10
14
|
end
|
11
15
|
end
|
12
16
|
|
13
17
|
class MemberData
|
14
18
|
attr_reader :member
|
15
19
|
|
16
|
-
|
17
|
-
|
20
|
+
attr_accessor :attributes
|
21
|
+
|
22
|
+
def initialize attributes
|
23
|
+
@attributes = attributes
|
24
|
+
|
25
|
+
@member = attributes['member']
|
18
26
|
end
|
19
27
|
end
|
20
28
|
|
data/lib/nephophobia/role.rb
CHANGED
data/lib/nephophobia/user.rb
CHANGED
@@ -2,10 +2,14 @@ module Nephophobia
|
|
2
2
|
class UserData
|
3
3
|
attr_reader :accesskey, :username, :secretkey
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
@
|
5
|
+
attr_accessor :attributes
|
6
|
+
|
7
|
+
def initialize attributes
|
8
|
+
@attributes = attributes
|
9
|
+
|
10
|
+
@accesskey = attributes['accesskey']
|
11
|
+
@username = attributes['username']
|
12
|
+
@secretkey = attributes['secretkey']
|
9
13
|
end
|
10
14
|
end
|
11
15
|
|
data/lib/nephophobia/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: nephophobia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- John Dewey
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-04-
|
14
|
+
date: 2011-04-21 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|