cirandas.net

ref: master

plugins/suppliers/serializers/suppliers_plugin/consumer_serializer.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module SuppliersPlugin
  class ConsumerSerializer < ApplicationSerializer

    attribute :id
    attribute :consumer_id
    attribute :name
    attribute :profile_name
    attribute :phone
    attribute :cell_phone
    attribute :email
    attribute :hub_id
    attribute :address
    attribute :city
    attribute :state
    attribute :zip
    attribute :profile_icon_thumb
    attribute :identifier
    attribute :active

    has_many :purchases

    def profile_icon_thumb
      scope.profile_icon(object, :thumb)
    end

    def purchases
      []
    end

    def profile_name
      object.profile.name
    end
  end
end