Class: PurchaseKit::Product::Demo

Inherits:
Object
  • Object
show all
Defined in:
lib/purchasekit/product/demo.rb

Overview

Demo implementation of Product for local development.

Reads product data from PurchaseKit.config.demo_products instead of making API calls. Designed for use with Xcode’s StoreKit testing.

Class Method Summary collapse

Class Method Details

.find(id) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/purchasekit/product/demo.rb', line 10

def find(id)
  product_data = PurchaseKit.config.demo_products[id]
  raise PurchaseKit::NotFoundError, "Product not found: #{id}" unless product_data

  Product.new(
    id: id,
    apple_product_id: product_data[:apple_product_id],
    google_product_id: product_data[:google_product_id],
    google_base_plan_id: product_data[:google_base_plan_id]
  )
end