Class: Ey::Core::Client::Provider
Instance Method Summary
collapse
assoc_accessor, assoc_coverage, assoc_reader, assoc_writer, associations, collection_reader
Methods inherited from Model
#destroy, range_parser, #to_s, #update!, #url
Instance Method Details
34
35
36
|
# File 'lib/ey-core/models/provider.rb', line 34
def account
self.connection.accounts.new(self.connection.get_account("url" => self.account_url).body["account"])
end
|
#database_server_snapshots ⇒ Object
25
26
27
|
# File 'lib/ey-core/models/provider.rb', line 25
def database_server_snapshots
connection.database_server_snapshots.load(connection.get_database_server_snapshots("provider" => self.id).body["database_server_snapshots"])
end
|
#destroy! ⇒ Object
38
39
40
|
# File 'lib/ey-core/models/provider.rb', line 38
def destroy!
connection.requests.new(self.connection.destroy_provider(self.id).body["request"])
end
|
#discover_database_server_snapshots ⇒ Object
29
30
31
|
# File 'lib/ey-core/models/provider.rb', line 29
def discover_database_server_snapshots
connection.requests.new(connection.discover_database_server_snapshots("provider" => self.id).body["request"])
end
|
#possible_locations(provider_type = self.type) ⇒ Object
21
22
23
|
# File 'lib/ey-core/models/provider.rb', line 21
def possible_locations(provider_type = self.type)
self.connection.get_possible_provider_locations(provider_type).body["locations"].map { |l| l["id"] }
end
|
#save ⇒ Object
Also known as:
save!
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/ey-core/models/provider.rb', line 42
def save
params = {
"url" => self.collection.url,
"account" => self.account_id,
"provider" => {
"credentials" => self.credentials,
"provisioned_id" => self.provisioned_id,
"type" => self.type,
},
}
if new_record?
connection.requests.new(self.connection.create_provider(params).body["request"])
else raise NotImplementedError end
end
|