Class: Spree::Api::AddressesController

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

Instance Attribute Summary

Attributes inherited from BaseController

#current_api_user

Instance Method Summary collapse

Methods inherited from BaseController

#map_nested_attributes_keys, #permitted_line_item_attributes, #set_jsonp_format

Methods included from ControllerSetup

included

Instance Method Details

#showObject



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

def show
  load_and_authorize_address(:read)
  respond_with(@address)
end

#updateObject



11
12
13
14
15
16
17
18
19
# File 'app/controllers/spree/api/addresses_controller.rb', line 11

def update
  load_and_authorize_address(:update)

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