Class: Venice::PendingRenewalInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/venice/pending_renewal_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ PendingRenewalInfo

Returns a new instance of PendingRenewalInfo.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/venice/pending_renewal_info.rb', line 31

def initialize(attributes)
  @expiration_intent = Integer(attributes['expiration_intent']) if attributes['expiration_intent']
  @auto_renew_status = Integer(attributes['auto_renew_status']) if attributes['auto_renew_status']
  @auto_renew_product_id = attributes['auto_renew_product_id']

  if attributes['is_in_billing_retry_period']
    @is_in_billing_retry_period = (attributes['is_in_billing_retry_period'] == '1')
  end

  @product_id = attributes['product_id']

  @price_consent_status = Integer(attributes['price_consent_status']) if attributes['price_consent_status']
  @cancellation_reason = Integer(attributes['cancellation_reason']) if attributes['cancellation_reason']
end

Instance Attribute Details

#auto_renew_product_idObject (readonly)

The current renewal preference for the auto-renewable subscription. The value for this key corresponds to the productIdentifier property of the product that the customer’s subscription renews.



13
14
15
# File 'lib/venice/pending_renewal_info.rb', line 13

def auto_renew_product_id
  @auto_renew_product_id
end

#auto_renew_statusObject (readonly)

The current renewal status for the auto-renewable subscription. This key is only present for auto-renewable subscription receipts, for active or expired subscriptions



9
10
11
# File 'lib/venice/pending_renewal_info.rb', line 9

def auto_renew_status
  @auto_renew_status
end

#cancellation_reasonObject (readonly)

For a transaction that was cancelled, the reason for cancellation. Use this value along with the cancellation date to identify possible issues in your app that may lead customers to contact Apple customer support.



29
30
31
# File 'lib/venice/pending_renewal_info.rb', line 29

def cancellation_reason
  @cancellation_reason
end

#expiration_intentObject (readonly)

For an expired subscription, the reason for the subscription expiration. This key is only present for a receipt containing an expired auto-renewable subscription.



5
6
7
# File 'lib/venice/pending_renewal_info.rb', line 5

def expiration_intent
  @expiration_intent
end

#is_in_billing_retry_periodObject (readonly)

For an expired subscription, whether or not Apple is still attempting to automatically renew the subscription. If the customer’s subscription failed to renew because the App Store was unable to complete the transaction, this value will reflect whether or not the App Store is still trying to renew the subscription.



17
18
19
# File 'lib/venice/pending_renewal_info.rb', line 17

def is_in_billing_retry_period
  @is_in_billing_retry_period
end

The current price consent status for a subscription price increase This key is only present for auto-renewable subscription receipts if the subscription price was increased without keeping the existing price for active subscribers



25
26
27
# File 'lib/venice/pending_renewal_info.rb', line 25

def price_consent_status
  @price_consent_status
end

#product_idObject (readonly)

The product identifier of the item that was purchased. This value corresponds to the productIdentifier property of the SKPayment object stored in the transaction’s payment property.



21
22
23
# File 'lib/venice/pending_renewal_info.rb', line 21

def product_id
  @product_id
end

Instance Method Details

#to_hashObject Also known as: to_h



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/venice/pending_renewal_info.rb', line 46

def to_hash
  {
    expiration_intent: @expiration_intent,
    auto_renew_status: @auto_renew_status,
    auto_renew_product_id: @auto_renew_product_id,
    is_in_billing_retry_period: @is_in_billing_retry_period,
    product_id: @product_id,
    price_consent_status: @price_consent_status,
    cancellation_reason: @cancellation_reason
  }
end

#to_jsonObject



60
61
62
# File 'lib/venice/pending_renewal_info.rb', line 60

def to_json
  to_hash.to_json
end