packethost 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packet/device.rb +23 -2
- data/lib/packet/project.rb +1 -0
- data/lib/packet/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fa844a97c3cb29ea57ea0b29c105d8bbbfbffdd
|
4
|
+
data.tar.gz: 5962f18cf83a4386106898e7eb2a85ac3d776715
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f0ca6a30ef3048d9172ad2fc44dd74303243cb707231cd0b30b64a6c951e50ec1b6488dc418c7ad8c364ee618f9d784530a73a271890a8c37caa2365a67db63
|
7
|
+
data.tar.gz: 75c5a20bef990685f0cbef3c285c6c29323d52b891d3f0e3d79d94b670f5577c1fe5b7eb8831b446853a325dc507365754d18bf7ce22adacf29f19e2636fab87
|
data/lib/packet/device.rb
CHANGED
@@ -1,9 +1,30 @@
|
|
1
|
+
require 'active_support/core_ext/object/try'
|
2
|
+
|
1
3
|
module Packet
|
2
4
|
class Device
|
3
5
|
include Entity
|
4
6
|
|
5
|
-
attr_accessor :hostname
|
6
|
-
|
7
|
+
attr_accessor :hostname, :iqn, :ip_addresses, :state, :tags, :userdata
|
8
|
+
has_one :operating_system
|
9
|
+
has_one :plan
|
10
|
+
has_one :facility
|
11
|
+
has_one :project
|
7
12
|
has_timestamps
|
13
|
+
|
14
|
+
def tags
|
15
|
+
(@tags ||= []).map(&:to_sym)
|
16
|
+
end
|
17
|
+
|
18
|
+
def ip_addresses
|
19
|
+
@ip_addresses ||= []
|
20
|
+
end
|
21
|
+
|
22
|
+
[:provisioning, :powering_on, :active, :powering_off, :inactive, :rebooting].each do |s|
|
23
|
+
define_method(:"#{s}?") { state == s }
|
24
|
+
end
|
25
|
+
|
26
|
+
def state
|
27
|
+
@state.try(:to_sym)
|
28
|
+
end
|
8
29
|
end
|
9
30
|
end
|
data/lib/packet/project.rb
CHANGED
data/lib/packet/version.rb
CHANGED