Sha256: aadd6bf9207613d6fc6f83085f69f613e2f2a1fc2a0b87513ac1b058c0fefe88

Contents?: true

Size: 721 Bytes

Versions: 4

Compression:

Stored size: 721 Bytes

Contents

module Rack
  class InAppPurchase
    class Product < Sequel::Model
      TYPES = ["Consumable", "Non-Consumable", "Free Subscription", "Auto-Renewable Subscription", "Non-Renewable Subscription"]

      plugin :json_serializer, naked: true, except: :id 
      plugin :validation_helpers
      plugin :timestamps, force: true, update_on_create: true
      
      self.dataset = :in_app_purchase_products
      self.strict_param_setting = false
      self.raise_on_save_failure = false

      def validate
        super
      
        validates_presence [:product_identifier, :title, :description, :price, :price_locale]
        validates_numeric :price
        validates_includes TYPES, :type
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rack-in-app-purchase-0.1.1 ./lib/rack/in-app-purchase/models/product.rb
rack-in-app-purchase-0.1.0 ./lib/rack/in-app-purchase/models/product.rb
rack-in-app-purchase-0.0.2 ./lib/rack/in-app-purchase/models/product.rb
rack-in-app-purchase-0.0.1 ./lib/rack/in-app-purchase/models/product.rb