Class: Spree::Api::V1::PropertiesController
  
  
  
  
  
    - Inherits:
- 
      BaseController
      
        
          - Object
- ActionController::Base
- BaseController
- Spree::Api::V1::PropertiesController
 show all
    - Defined in:
- app/controllers/spree/api/v1/properties_controller.rb
 
  Instance Attribute Summary
  
  
  #current_api_user
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  #content_type, #permitted_line_item_attributes
  
  
  
  
  
  
  
  
  
  
  
  included
  
  
    Instance Method Details
    
      
  
  
    #create  ⇒ Object 
  
  
  
  
    | 
26
27
28
29
30
31
32
33
34 | # File 'app/controllers/spree/api/v1/properties_controller.rb', line 26
def create
  authorize! :create, Property
  @property = Spree::Property.new(property_params)
  if @property.save
    respond_with(@property, status: 201, default_template: :show)
  else
    invalid_resource!(@property)
  end
end | 
 
    
      
  
  
    #destroy  ⇒ Object 
  
  
  
  
    | 
46
47
48
49
50
51
52
53
54 | # File 'app/controllers/spree/api/v1/properties_controller.rb', line 46
def destroy
  if @property
    authorize! :destroy, @property
    @property.destroy
    respond_with(@property, status: 204)
  else
    invalid_resource!(@property)
  end
end | 
 
    
      
  
  
    #index  ⇒ Object 
  
  
  
  
    | 
7
8
9
10
11
12
13
14
15
16
17
18 | # File 'app/controllers/spree/api/v1/properties_controller.rb', line 7
def index
  @properties = Spree::Property.accessible_by(current_ability)
  @properties = if params[:ids]
                  @properties.where(id: params[:ids].split(',').flatten)
                else
                  @properties.ransack(params[:q]).result
                end
  @properties = @properties.page(params[:page]).per(params[:per_page])
  respond_with(@properties)
end | 
 
    
      
  
  
    #new  ⇒ Object 
  
  
  
  
    | 
24 | # File 'app/controllers/spree/api/v1/properties_controller.rb', line 24
def new; end | 
 
    
      
  
  
    #show  ⇒ Object 
  
  
  
  
    | 
20
21
22 | # File 'app/controllers/spree/api/v1/properties_controller.rb', line 20
def show
  respond_with(@property)
end | 
 
    
      
  
  
    #update  ⇒ Object 
  
  
  
  
    | 
36
37
38
39
40
41
42
43
44 | # File 'app/controllers/spree/api/v1/properties_controller.rb', line 36
def update
  if @property
    authorize! :update, @property
    @property.update(property_params)
    respond_with(@property, status: 200, default_template: :show)
  else
    invalid_resource!(@property)
  end
end |