Module: Hawkei::APIOperation::Save::ClassMethods

Defined in:
lib/hawkei/api_operation/save.rb

Instance Method Summary collapse

Instance Method Details

#create(params = {}, options = {}) ⇒ Hawkei::Object

Create an API Resource and validate the params for the API.

Parameters:

  • params (Hash) (defaults to: {})

    for the request

  • Additional (Hash)

    options for the request

Returns:

  • (Hawkei::Object)

    response from the API



15
16
17
18
# File 'lib/hawkei/api_operation/save.rb', line 15

def create(params = {}, options = {})
  response = request(:post, resource_path, params, options)
  initialize_from(response)
end

#update(id, params = {}, options = {}) ⇒ Hawkei::Object

Update an API Resource and validate params for the API

Parameters:

  • id (String)

    for the request

  • params (Hash) (defaults to: {})

    for the request

  • Additional (Hash)

    options for the request

Returns:

  • (Hawkei::Object)

    response from the API



28
29
30
31
# File 'lib/hawkei/api_operation/save.rb', line 28

def update(id, params = {}, options = {})
  response = request(:put, "#{resource_path}/#{id}", params, options)
  initialize_from(response)
end