Class: Ey::Core::Model
- Inherits:
-
Cistern::Model
- Object
- Cistern::Model
- Ey::Core::Model
show all
- Defined in:
- lib/ey-core/model.rb
Direct Known Subclasses
Client::Account, Client::AccountCancellation, Client::AccountReferral, Client::AccountTrial, Client::Addon, Client::Address, Client::Alert, Client::Application, Client::ApplicationArchive, Client::ApplicationDeployment, Client::BackupFile, Client::Billing, Client::Blueprint, Client::Component, Client::Contact, Client::Cost, Client::DatabasePlanUsage, Client::DatabaseServer, Client::DatabaseServerRevision, Client::DatabaseServerSnapshot, Client::DatabaseServerUsage, Client::DatabaseService, Client::Deployment, Client::Environment, Client::EnvironmentPlanUsage, Client::Feature, Client::Firewall, Client::FirewallRule, Client::Gem, Client::Keypair, Client::KeypairDeployment, Client::LegacyAlert, Client::LoadBalancer, Client::LoadBalancerNode, Client::LoadBalancerService, Client::Log, Client::LogicalDatabase, Client::Membership, Client::Message, Client::PlanUsage, Client::Provider, Client::ProviderLocation, Client::Request, Client::Server, Client::ServerEvent, Client::ServerUsage, Client::SslCertificate, Client::Storage, Client::StorageUser, Client::SupportTrial, Client::Task, Client::Token, Client::UntrackedAddress, Client::UntrackedServer, Client::User, Client::Volume
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.range_parser(v) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/ey-core/model.rb', line 15
def self.range_parser(v)
case v
when Range then
v
when String then
first, last = v.split("-").map(&:to_i)
last ||= first
Range.new(first, last)
else
v
end
end
|
Instance Method Details
#destroy ⇒ Object
39
40
41
42
43
|
# File 'lib/ey-core/model.rb', line 39
def destroy
destroy!
rescue Ey::Core::Response::Error
false
end
|
#save ⇒ Object
33
34
35
36
37
|
# File 'lib/ey-core/model.rb', line 33
def save
save!
rescue Ey::Core::Response::Error
false
end
|
#to_s ⇒ Object
10
11
12
13
|
# File 'lib/ey-core/model.rb', line 10
def to_s
shortname = self.class.name.split("::").last
"#{shortname}:#{id}"
end
|
#update!(attributes) ⇒ Object
28
29
30
31
|
# File 'lib/ey-core/model.rb', line 28
def update!(attributes)
merge_attributes(attributes)
save!
end
|
#url ⇒ Object
2
3
4
5
6
7
8
|
# File 'lib/ey-core/model.rb', line 2
def url
if self.class.attributes[:url]
read_attribute(:url)
else
"#{self.collection.url}/#{self.id}"
end
end
|