Class: HCloud::Resource
- Inherits:
-
Object
show all
- Includes:
- ActiveModel::AttributeAssignment, ActiveModel::Attributes
- Defined in:
- lib/hcloud/resource.rb
Direct Known Subclasses
Action, Certificate, Datacenter, Firewall, FloatingIP, ISO, Image, LoadBalancer, LoadBalancerType, Location, Metadata, Network, PlacementGroup, Pricing, PrimaryIP, RRSet, SSHKey, Server, ServerType, StorageBox, StorageBoxSnapshot, StorageBoxSubaccount, StorageBoxType, Volume, Zone
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(attributes = {}) ⇒ Resource
Returns a new instance of Resource.
14
15
16
17
18
|
# File 'lib/hcloud/resource.rb', line 14
def initialize(attributes = {})
super()
assign_attributes(attributes) if attributes
end
|
Class Method Details
.client ⇒ Object
40
41
42
|
# File 'lib/hcloud/resource.rb', line 40
def self.client
HCloud::Client.connection
end
|
.resource_name ⇒ Object
36
37
38
|
# File 'lib/hcloud/resource.rb', line 36
def self.resource_name
name.demodulize.underscore
end
|
Instance Method Details
#==(other) ⇒ Object
32
33
34
|
# File 'lib/hcloud/resource.rb', line 32
def ==(other)
id && id == other.id
end
|
#mutable? ⇒ Boolean
20
21
22
|
# File 'lib/hcloud/resource.rb', line 20
def mutable?
true
end
|
#to_h ⇒ Object
26
27
28
29
30
|
# File 'lib/hcloud/resource.rb', line 26
def to_h
{
id: id,
}
end
|