Class: Nova::API::Resource::Apportionment
- Inherits:
-
Base
show all
- Defined in:
- lib/nova/api/resource/apportionment.rb
Constant Summary
collapse
- ALLOWED_ATTRIBUTES =
%i[name]
Constants inherited
from Base
Base::PRODUCTION_HOST, Base::SCHEME, Base::STAGING_HOST
Utils::BaseStruct::DATE_REGEX
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
base_url
#allowed_attributes
Class Method Details
.create(parameters) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/nova/api/resource/apportionment.rb', line 20
def self.create(parameters)
model = new parameters
model.attributes.delete(:id)
model.save
end
|
.destroy(id) ⇒ Object
34
35
36
37
38
|
# File 'lib/nova/api/resource/apportionment.rb', line 34
def self.destroy(id)
model = initialize_empty_model_with_id(self, id)
model.destroy
end
|
.endpoint ⇒ Object
12
13
14
|
# File 'lib/nova/api/resource/apportionment.rb', line 12
def self.endpoint
'/api/apportionments'
end
|
.list(parameters = {}) ⇒ Object
16
17
18
|
# File 'lib/nova/api/resource/apportionment.rb', line 16
def self.list(parameters = {})
do_get_search(endpoint, parameters.to_h)
end
|
.reactivate(id) ⇒ Object
40
41
42
43
44
|
# File 'lib/nova/api/resource/apportionment.rb', line 40
def self.reactivate(id)
model = initialize_empty_model_with_id(self, id)
model.reactivate
end
|
.update(id, parameters) ⇒ Object
28
29
30
31
32
|
# File 'lib/nova/api/resource/apportionment.rb', line 28
def self.update(id, parameters)
model = new parameters.merge(id: id)
model.update
end
|
Instance Method Details
#destroy ⇒ Object
66
67
68
69
70
|
# File 'lib/nova/api/resource/apportionment.rb', line 66
def destroy
protect_operation_from_missing_value
do_delete("#{endpoint}")
end
|
#endpoint ⇒ Object
46
47
48
49
50
|
# File 'lib/nova/api/resource/apportionment.rb', line 46
def endpoint
protect_operation_from_missing_value
"/api/apportionments/#{id}"
end
|
#reactivate ⇒ Object
72
73
74
75
76
|
# File 'lib/nova/api/resource/apportionment.rb', line 72
def reactivate
protect_operation_from_missing_value
do_patch("#{endpoint}/reactivate", {})
end
|
#save ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/nova/api/resource/apportionment.rb', line 52
def save
if id.nil?
do_post(self.class.endpoint, allowed_attributes)
else
do_patch("#{endpoint}", allowed_attributes)
end
end
|
#update ⇒ Object
60
61
62
63
64
|
# File 'lib/nova/api/resource/apportionment.rb', line 60
def update
protect_operation_from_missing_value
do_patch("#{endpoint}", allowed_attributes)
end
|