Class: Dynectastic::ZoneFactory
- Inherits:
-
Resource
- Object
- Resource
- Dynectastic::ZoneFactory
show all
- Defined in:
- lib/dynectastic/factories/zone_factory.rb
Instance Attribute Summary
Attributes inherited from Resource
#factory, #last_request, #session
Instance Method Summary
collapse
Methods inherited from Resource
#attributes=, #delete, #get, #initialize, #post, #put
Instance Method Details
#build(attributes) ⇒ Object
5
6
7
8
9
|
# File 'lib/dynectastic/factories/zone_factory.rb', line 5
def build(attributes)
zone = Dynectastic::Zone.new(session, self)
zone.attributes = attributes
zone
end
|
#destroy(name) ⇒ Object
36
37
38
|
# File 'lib/dynectastic/factories/zone_factory.rb', line 36
def destroy(name)
delete("#{ entity_base }/#{ name }")
end
|
#entity_base ⇒ Object
40
41
42
|
# File 'lib/dynectastic/factories/zone_factory.rb', line 40
def entity_base
"/REST/Zone"
end
|
#find_all ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/dynectastic/factories/zone_factory.rb', line 15
def find_all
zones = []
get("#{ entity_base }/").each do |full_zone_path|
zone_name = full_zone_path.split('/').last
zones << find_by_name(zone_name)
end
zones
end
|
#find_by_name(name = nil) ⇒ Object
11
12
13
|
# File 'lib/dynectastic/factories/zone_factory.rb', line 11
def find_by_name(name=nil)
build api_parameters_to_attributes(get("#{ entity_base }/#{ name }/"))
end
|
#freeze(name) ⇒ Object
28
29
30
|
# File 'lib/dynectastic/factories/zone_factory.rb', line 28
def freeze(name)
put("#{ entity_base }/#{ name }", :body => { :freeze => true } )
end
|
#publish(name) ⇒ Object
24
25
26
|
# File 'lib/dynectastic/factories/zone_factory.rb', line 24
def publish(name)
put("#{ entity_base }/#{ name }", :body => { :publish => true } )
end
|
#unfreeze(name) ⇒ Object
32
33
34
|
# File 'lib/dynectastic/factories/zone_factory.rb', line 32
def unfreeze(name)
put("#{ entity_base }/#{ name }", :body => { :thaw => true } )
end
|