packethost 0.0.5 → 0.0.6

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: 49af2e9f6b1dcbd450120490692d16424a78a49a
4
- data.tar.gz: e53e3fa0490ebb50c86fe6e576adeb5f7bacf043
3
+ metadata.gz: 4af7994c743b41680d9c33fff01f92970d4dda6f
4
+ data.tar.gz: fca57312b2494d3525d941a81f6a25c49e989660
5
5
  SHA512:
6
- metadata.gz: 6d94f1b5994897df5392eed8bcfa2ea77ba224eb7619a3bc03b2da75ef108552e05416150653d696477e16e90983cf0dc0c8dbd231e458ba8099f0c36e311a40
7
- data.tar.gz: 3e23e77b9d8f4f8fb7dbeb76756c29ff18738be4222c46e6f151c30c3585392862be0c9f32188d5f1489f0391ed5775e3fe4b2d570594cc218ed69e965eead98
6
+ metadata.gz: 5079c86b48f40a3b392d3b0560c24faf9c2e759644140ef5dd49eb6c25bcee42f56db0edee4546af7bd70f136e7896748596a1161fab6c10b7ed39db40fb6560
7
+ data.tar.gz: 27979e3a9907f9ce8ed30b75d47b4750943bacba85ebb155dfae325e5d57241daec3c4374baa8f286acb5383d9b601e0893a17fe58d0f768779798ed9d00c597
@@ -1,6 +1,11 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ v0.0.6
5
+ ------
6
+
7
+ * [Fix serialization of devices to solve problems with create_device.](https://github.com/packethost/packet-rb/pull/7) (thanks @kke)
8
+
4
9
  v0.0.5
5
10
  ------
6
11
 
@@ -4,7 +4,7 @@ module Packet
4
4
  class Device
5
5
  include Entity
6
6
 
7
- attr_accessor :hostname, :iqn, :ip_addresses, :state, :tags, :userdata
7
+ attr_accessor :hostname, :iqn, :ip_addresses, :state, :tags, :userdata, :project_id
8
8
  has_one :operating_system
9
9
  has_one :plan
10
10
  has_one :facility
@@ -5,11 +5,21 @@ module Packet
5
5
  module Serialization
6
6
  extend ActiveSupport::Concern
7
7
 
8
+ class_methods do
9
+ def serializer_key(value)
10
+ define_method :to_value do
11
+ instance_variable_get "@#{value}"
12
+ end
13
+ end
14
+ end
15
+
8
16
  def to_hash
9
17
  instance_variables.reject { |ivar| [:@client].include?(ivar) }.map do |ivar|
10
- [ivar.to_s.tr('@', ''), instance_variable_get(ivar)]
18
+ ival = instance_variable_get(ivar)
19
+ [ivar.to_s.tr('@', ''), ival.respond_to?(:to_value) ? ival.to_value : instance_variable_get(ivar)]
11
20
  end.to_h
12
21
  end
22
+
13
23
  alias to_h to_hash
14
24
  end
15
25
  end
@@ -5,5 +5,7 @@ module Packet
5
5
  attr_accessor :name
6
6
  attr_accessor :code
7
7
  attr_accessor :features
8
+
9
+ serializer_key :code
8
10
  end
9
11
  end
@@ -7,5 +7,7 @@ module Packet
7
7
  attr_accessor :distro
8
8
  attr_accessor :version
9
9
  attr_accessor :provisionable_on
10
+
11
+ serializer_key :slug
10
12
  end
11
13
  end
@@ -8,5 +8,7 @@ module Packet
8
8
  attr_accessor :line
9
9
  attr_accessor :specs
10
10
  attr_accessor :pricing
11
+
12
+ serializer_key :slug
11
13
  end
12
14
  end
@@ -7,5 +7,9 @@ module Packet
7
7
  has_many :devices
8
8
  has_many :ssh_keys
9
9
  has_timestamps
10
+
11
+ def new_device(opts = {})
12
+ Packet::Device.new(opts.merge(project_id: id))
13
+ end
10
14
  end
11
15
  end
@@ -5,6 +5,8 @@ module Packet
5
5
  attr_accessor :label
6
6
  attr_accessor :key
7
7
 
8
+ serializer_key :id
9
+
8
10
  has_timestamps
9
11
  end
10
12
  end
@@ -1,3 +1,3 @@
1
1
  module Packet
2
- VERSION = '0.0.5'.freeze
2
+ VERSION = '0.0.6'.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.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Bell
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-03-08 00:00:00.000000000 Z
13
+ date: 2016-05-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  version: '0'
247
247
  requirements: []
248
248
  rubyforge_project:
249
- rubygems_version: 2.4.5.1
249
+ rubygems_version: 2.2.2
250
250
  signing_key:
251
251
  specification_version: 4
252
252
  summary: Ruby client for the Packet API