Class: PostyClient::Resources::Domain
- Inherits:
-
Base
- Object
- Base
- PostyClient::Resources::Domain
show all
- Defined in:
- lib/posty_client/resources/domain.rb
Instance Attribute Summary
Attributes inherited from Base
#attributes, #errors, #name, #new_resource
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
base_uri, #base_uri, #create, #delete, #load, #new_resource?, #request_with_error_handling, resource_name, #resource_name, #save, #update
Constructor Details
#initialize(name = nil) ⇒ Domain
Returns a new instance of Domain.
21
22
23
24
|
# File 'lib/posty_client/resources/domain.rb', line 21
def initialize(name=nil)
@name = name
load if name
end
|
Class Method Details
.all ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/posty_client/resources/domain.rb', line 5
def self.all
response = RestClient.get([base_uri, resource_name].join('/'))
return nil unless response.code == 200
data = JSON.parse(response)
data.collect do |datum|
model = self.new
model.attributes = datum.flatten.last
model.new_resource = false
model
end
end
|
Instance Method Details
#resource_slug ⇒ Object
38
39
40
|
# File 'lib/posty_client/resources/domain.rb', line 38
def resource_slug
[base_uri, 'domains'].join('/')
end
|
#slug ⇒ Object
34
35
36
|
# File 'lib/posty_client/resources/domain.rb', line 34
def slug
[resource_slug, name].join('/')
end
|