Class: Spree::Api::V1::AddressesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/v1/addresses_controller.rb

Instance Attribute Summary

Attributes inherited from BaseController

#current_api_user

Instance Method Summary collapse

Methods inherited from BaseController

#content_type, #permitted_line_item_attributes

Methods included from ControllerSetup

included

Instance Method Details

#showObject



7
8
9
10
11
# File 'app/controllers/spree/api/v1/addresses_controller.rb', line 7

def show
  authorize! :read, @order, order_token
  @address = find_address
  respond_with(@address)
end

#updateObject



13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/spree/api/v1/addresses_controller.rb', line 13

def update
  authorize! :update, @order, order_token
  @address = find_address

  if @address.update_attributes(address_params)
    respond_with(@address, default_template: :show)
  else
    invalid_resource!(@address)
  end
end