Class: Travis::Client::SingletonSetting
- Inherits:
-
Entity
- Object
- Entity
- Travis::Client::SingletonSetting
show all
- Defined in:
- lib/travis/client/singleton_setting.rb
Direct Known Subclasses
SshKey
Constant Summary
Constants inherited
from Entity
Entity::MAP
Instance Attribute Summary
Attributes inherited from Entity
#attributes, #curry, #id, #session
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Entity
#[], #[]=, aka, #attribute_names, attributes, #cancelable?, cast_id, #complete?, has, has_singleton, id?, id_field, #include?, #initialize, #inspect, inspect_info, #load, many, #missing?, one, preloadable, preloadable?, relations, #relations, #reload, #restartable?, subclass_for, subclasses, time, #to_h, #update_attributes, weak?
Class Method Details
.base_path ⇒ Object
6
7
8
|
# File 'lib/travis/client/singleton_setting.rb', line 6
def self.base_path
"settings/#{one}"
end
|
Instance Method Details
#delete ⇒ Object
27
28
29
30
31
|
# File 'lib/travis/client/singleton_setting.rb', line 27
def delete
session.delete_raw(path)
reload
true
end
|
#path ⇒ Object
16
17
18
|
# File 'lib/travis/client/singleton_setting.rb', line 16
def path
"#{self.class.base_path}/#{id}"
end
|
#repository_id ⇒ Object
12
13
14
|
# File 'lib/travis/client/singleton_setting.rb', line 12
def repository_id
id
end
|
#update(values = {}) ⇒ Object
Also known as:
save
20
21
22
23
24
25
|
# File 'lib/travis/client/singleton_setting.rb', line 20
def update(values = {})
values = { 'value' => values } unless values.is_a? Hash
values.each { |key, value| attributes[key.to_s] = value.to_s }
session.patch_raw(path, JSON.dump(self.class.one => attributes))
reload
end
|