ForestAdmin/forest-rails

View on GitHub
app/serializers/forest_liana/stripe_payment_serializer.rb

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
module ForestLiana
  class StripePaymentSerializer
    include ForestAdmin::JSONAPI::Serializer

    attribute :description
    attribute :refunded
    attribute :currency
    attribute :status
    attribute :amount
    attribute :created

    has_one :customer

    def self_link
      "/forest#{super}"
    end

    def type
      @options[:context][:type] || 'stripe_payments'
    end

    def format_name(attribute_name)
      attribute_name.to_s
    end

    def unformat_name(attribute_name)
      attribute_name.to_s
    end

    def relationship_self_link(attribute_name)
      nil
    end

    def relationship_related_link(attribute_name)
      nil
    end
  end
end