Class: Spree::Api::V2::Storefront::PendingLineItemsController

Inherits:
ResourceController
  • Object
show all
Defined in:
app/controllers/spree/api/v2/storefront/pending_line_items_controller.rb

Instance Method Summary collapse

Instance Method Details

#allowed_sort_attributesObject



31
32
33
34
# File 'app/controllers/spree/api/v2/storefront/pending_line_items_controller.rb', line 31

def allowed_sort_attributes
  super << :to_date
  super << :from_date
end

#collectionObject



18
19
20
21
22
23
# File 'app/controllers/spree/api/v2/storefront/pending_line_items_controller.rb', line 18

def collection
  Spree::LineItem.joins(:guests)
                 .where(order: spree_current_user.orders.complete, guests: { upload_later: true })
                 .distinct
                 .page(params[:page]).per(params[:per_page])
end

#collection_serializerObject

override



9
10
11
# File 'app/controllers/spree/api/v2/storefront/pending_line_items_controller.rb', line 9

def collection_serializer
  Spree::V2::Storefront::LineItemSerializer
end

#indexObject



25
26
27
28
29
# File 'app/controllers/spree/api/v2/storefront/pending_line_items_controller.rb', line 25

def index
  render_serialized_payload do
    serialize_collection(paginated_collection)
  end
end

#resource_serializerObject

override



14
15
16
# File 'app/controllers/spree/api/v2/storefront/pending_line_items_controller.rb', line 14

def resource_serializer
  Spree::V2::Storefront::LineItemSerializer
end