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.
15
16
17
18
19
|
# File 'lib/hcloud/resource.rb', line 15
def initialize(attributes = {})
super()
assign_attributes(attributes) if attributes
end
|
Class Method Details
.client ⇒ Object
41
42
43
|
# File 'lib/hcloud/resource.rb', line 41
def self.client
HCloud::Client.connection
end
|
.resource_name ⇒ Object
37
38
39
|
# File 'lib/hcloud/resource.rb', line 37
def self.resource_name
name.demodulize.underscore
end
|
Instance Method Details
#==(other) ⇒ Object
33
34
35
|
# File 'lib/hcloud/resource.rb', line 33
def ==(other)
id && id == other.id
end
|
#mutable? ⇒ Boolean
21
22
23
|
# File 'lib/hcloud/resource.rb', line 21
def mutable?
true
end
|
#to_h ⇒ Object
27
28
29
30
31
|
# File 'lib/hcloud/resource.rb', line 27
def to_h
{
id: id,
}
end
|