Class: Moniker::Server
- Inherits:
-
Common
- Object
- ActiveResource::Base
- Base
- Common
- Moniker::Server
- Defined in:
- lib/moniker/server.rb
Overview
A Moniker Server
Attributes
-
name
- Name of this image -
updated_at
- Modification date -
created_at
- Creation date
Class Method Summary collapse
Instance Method Summary collapse
-
#encode(options = {}) ⇒ Object
Overloads ActiveRecord::encode method.
-
#initialize(attributes = {}, persisted = false) ⇒ Server
constructor
:notnew:.
Methods inherited from Common
collection_path, custom_method_collection_url, element_path
Methods inherited from Base
Methods inherited from ActiveResource::Base
Constructor Details
#initialize(attributes = {}, persisted = false) ⇒ Server
:notnew:
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/moniker/server.rb', line 38 def initialize(attributes = {}, persisted = false) # :notnew: attributes = attributes.with_indifferent_access new_attributes = { :id => attributes[:id], :name => attributes[:name], :updated_at => attributes[:created_at].present? ? DateTime.strptime(attributes[:created_at], Moniker::DATETIME_FORMAT) : nil, :created_at => attributes[:created_at].present? ? DateTime.strptime(attributes[:created_at], Moniker::DATETIME_FORMAT) : nil } super(new_attributes, persisted) end |
Class Method Details
.find_by_name(name, options = {}) ⇒ Object
59 60 61 |
# File 'lib/moniker/server.rb', line 59 def self.find_by_name(name, = {}) all().detect { |domain| domain.name == name } end |
Instance Method Details
#encode(options = {}) ⇒ Object
Overloads ActiveRecord::encode method
51 52 53 54 55 56 57 |
# File 'lib/moniker/server.rb', line 51 def encode(={}) # :nodoc: Custom encoding to deal with moniker API to_encode = { :name => name } to_encode.send("to_#{self.class.format.extension}", ) end |