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.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/venice/pending_renewal_info.rb', line 34

def initialize(attributes)
  @original_json_data = 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.



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

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



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

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.



32
33
34
# File 'lib/venice/pending_renewal_info.rb', line 32

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.



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

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.



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

def is_in_billing_retry_period
  @is_in_billing_retry_period
end

#original_json_dataObject (readonly)

Original JSON data returned from Apple for a PendingRenewalInfo object.



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

def original_json_data
  @original_json_data
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



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

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.



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

def product_id
  @product_id
end

Instance Method Details

#to_hashObject Also known as: to_h



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/venice/pending_renewal_info.rb', line 50

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



64
65
66
# File 'lib/venice/pending_renewal_info.rb', line 64

def to_json
  to_hash.to_json
end