Class: Monza::RenewalInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/monza/renewal_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ RenewalInfo

Returns a new instance of RenewalInfo.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/monza/renewal_info.rb', line 18

def initialize(attributes)

  @product_id = attributes['product_id']
  @auto_renew_product_id = attributes['auto_renew_product_id']
  @original_transaction_id = attributes['original_transaction_id']

  if attributes['grace_period_expires_date']
    @grace_period_expires_date = DateTime.parse(attributes['grace_period_expires_date'])
  end
  if attributes['grace_period_expires_date_ms']
    @grace_period_expires_date_ms = Time.zone.at(attributes['grace_period_expires_date_ms'].to_i / 1000)
  end
  if attributes['grace_period_expires_date_pst']
    @grace_period_expires_date_pst = DateTime.parse(attributes['grace_period_expires_date_pst'].gsub("America/Los_Angeles","PST"))
  end
  if attributes['expiration_intent']
    @expiration_intent = attributes['expiration_intent']
  end

  if attributes['is_in_billing_retry_period']
    @is_in_billing_retry_period = attributes['is_in_billing_retry_period'].to_bool
  end

  if attributes['auto_renew_status']
    @will_renew = attributes['auto_renew_status'].to_bool
  end
end

Instance Attribute Details

#auto_renew_product_idObject (readonly)

Returns the value of attribute auto_renew_product_id.



10
11
12
# File 'lib/monza/renewal_info.rb', line 10

def auto_renew_product_id
  @auto_renew_product_id
end

#expiration_intentObject (readonly)



8
9
10
# File 'lib/monza/renewal_info.rb', line 8

def expiration_intent
  @expiration_intent
end

#grace_period_expires_dateObject (readonly)

Returns the value of attribute grace_period_expires_date.



14
15
16
# File 'lib/monza/renewal_info.rb', line 14

def grace_period_expires_date
  @grace_period_expires_date
end

#grace_period_expires_date_msObject (readonly)

Returns the value of attribute grace_period_expires_date_ms.



15
16
17
# File 'lib/monza/renewal_info.rb', line 15

def grace_period_expires_date_ms
  @grace_period_expires_date_ms
end

#grace_period_expires_date_pstObject (readonly)

Returns the value of attribute grace_period_expires_date_pst.



16
17
18
# File 'lib/monza/renewal_info.rb', line 16

def grace_period_expires_date_pst
  @grace_period_expires_date_pst
end

#is_in_billing_retry_periodObject (readonly)

Returns the value of attribute is_in_billing_retry_period.



12
13
14
# File 'lib/monza/renewal_info.rb', line 12

def is_in_billing_retry_period
  @is_in_billing_retry_period
end

#original_transaction_idObject (readonly)

Returns the value of attribute original_transaction_id.



11
12
13
# File 'lib/monza/renewal_info.rb', line 11

def original_transaction_id
  @original_transaction_id
end

#product_idObject (readonly)

Returns the value of attribute product_id.



9
10
11
# File 'lib/monza/renewal_info.rb', line 9

def product_id
  @product_id
end

#will_renewObject (readonly)

Returns the value of attribute will_renew.



13
14
15
# File 'lib/monza/renewal_info.rb', line 13

def will_renew
  @will_renew
end