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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c98c2bd2f24e9a66aedcbb98fdbabd543cea562
4
- data.tar.gz: 4ce409f660fe4bc486051aafff5cedd42da3d9e5
3
+ metadata.gz: 3fa844a97c3cb29ea57ea0b29c105d8bbbfbffdd
4
+ data.tar.gz: 5962f18cf83a4386106898e7eb2a85ac3d776715
5
5
  SHA512:
6
- metadata.gz: 42987ca54bc9eb6f88c87b025a88ebb4126741bfef9b452b6e341f61bb1b45bffbd2ea187892f745aa43a17ff02f258abaf9409d6a0453e9e761755fdeef8448
7
- data.tar.gz: c1141b24edc4e608c126e7822843c8bb085d6e5185dc1cc80ca91f920b03e83e906238dad99df0540d9d6347fa66b78c46da3c62ac2358ed1053c780bba28858
6
+ metadata.gz: 7f0ca6a30ef3048d9172ad2fc44dd74303243cb707231cd0b30b64a6c951e50ec1b6488dc418c7ad8c364ee618f9d784530a73a271890a8c37caa2365a67db63
7
+ data.tar.gz: 75c5a20bef990685f0cbef3c285c6c29323d52b891d3f0e3d79d94b670f5577c1fe5b7eb8831b446853a325dc507365754d18bf7ce22adacf29f19e2636fab87
@@ -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
@@ -5,6 +5,7 @@ module Packet
5
5
  attr_accessor :name
6
6
 
7
7
  has_many :devices
8
+ has_many :ssh_keys
8
9
  has_timestamps
9
10
  end
10
11
  end
@@ -1,3 +1,3 @@
1
1
  module Packet
2
- VERSION = '0.0.3'.freeze
2
+ VERSION = '0.0.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packethost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Bell