Module: FatZebra::APIOperation::Save::ClassMethods
- Defined in:
- lib/fat_zebra/api_operation/save.rb
Instance Method Summary collapse
-
#create(params = {}, options = {}) ⇒ FatZebra::Object
Create an API Resource and validate the params for the API.
-
#update(id, params = {}, options = {}) ⇒ FatZebra::Object
Update an API Resource and validate params for the API.
Instance Method Details
#create(params = {}, options = {}) ⇒ FatZebra::Object
Create an API Resource and validate the params for the API.
18 19 20 21 22 23 |
# File 'lib/fat_zebra/api_operation/save.rb', line 18 def create(params = {}, = {}) valid!(params, :create) if respond_to?(:valid!) response = request(:post, resource_path, params, ) initialize_from(response) end |
#update(id, params = {}, options = {}) ⇒ FatZebra::Object
Update an API Resource and validate params for the API
33 34 35 36 37 38 |
# File 'lib/fat_zebra/api_operation/save.rb', line 33 def update(id, params = {}, = {}) valid!(params, :update) if respond_to?(:valid!) response = request(:put, "#{resource_path}/#{id}", params, ) initialize_from(response) end |