stripe_local 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2840a8f7e75a91a3fa62470ef63fa17ac7108269
4
- data.tar.gz: cce9e0311e2da07c0774a5202af3c987a656b272
3
+ metadata.gz: 1c68aa4d6366705198c9794090f4b968675a1eb2
4
+ data.tar.gz: 076d8c5e321492e3c3d8d70e2507025e9fcde5d8
5
5
  SHA512:
6
- metadata.gz: f993ab389d1f903ab10fa356f92ea273b38e21115d94b645dffd14d327433fe734757ca2887061cf5414c296e171a24fcab9630939fdbb7967ba85c53f39900b
7
- data.tar.gz: cdd80e5ba07051b0b3a1915bee0aabcc5ce13be7977f9fb60f98f79a60e219db29bfe1162c3513c842f6ab53f09dc5ac2887da8f5e086e9b97e97116fd7f653f
6
+ metadata.gz: 0f6df3f43b07cca40cb77ff4564c59530dc98a8afd0f3ec8fb5b829448f8268cb7ee1cae192db0639a266cf2cc9e793024b9cc3bb64a7b68ce20419e4d42f73c
7
+ data.tar.gz: d7f8b5a968c52ae71b1f6e41d75fccf56e2fb3b40e94a9cb033d07a07100f813beef56fb5201622040fd7bbd14449d78d4396d4ce18bec63c214c7580cc43bd8
@@ -44,5 +44,10 @@ module StripeLocal
44
44
  end
45
45
  alias :inspect :to_s
46
46
  end
47
-
47
+ #=!=#
48
+ # ==Database Schema
49
+ #
50
+ # integer :available
51
+ # integer :pending
52
+ #=¡=#
48
53
  end
@@ -59,18 +59,17 @@ module StripeLocal
59
59
  MultiJson.load read_attribute( :metadata ), symbolize_keys: true
60
60
  end
61
61
 
62
- #=!=>>>
63
- # ~<Schema>~
64
- # t.string :id
65
- # t.integer :account_balance
66
- # t.string :default_card
67
- # t.boolean :delinquent
68
- # t.string :description
69
- # t.string :email
70
- # t.text :metadata
71
- # t.integer :model_id
72
- # t.timestamps
73
-
74
- #=¡=>>>
75
62
  end
63
+ #=!=#
64
+ # ==Database Schema
65
+ #
66
+ # string :id
67
+ # integer :account_balance
68
+ # string :default_card
69
+ # boolean :delinquent
70
+ # string :description
71
+ # string :email
72
+ # text :metadata
73
+ # integer :model_id
74
+ #=¡=#
76
75
  end
@@ -35,11 +35,11 @@ module StripeLocal
35
35
  end
36
36
 
37
37
  def succeed inv
38
- #TODO: implement this
38
+ find( inv.id ).update_attributes closed: true, paid: true, next_payment_attempt: nil
39
39
  end
40
40
 
41
41
  def fail inv
42
- #TODO: implement this
42
+ find( inv.id ).update_attributes paid: false
43
43
  end
44
44
 
45
45
  def paid
@@ -53,25 +53,27 @@ module StripeLocal
53
53
  end
54
54
 
55
55
 
56
- #=!=#>>>
57
- # string :id
58
- # string :customer_id
59
- # integer :amount_due
60
- # integer :subtotal
61
- # integer :total
62
- # boolean :attempted
63
- # integer :attempt_count
64
- # boolean :paid
65
- # boolean :closed
66
- # datetime :date
67
- # datetime :period_start
68
- # datetime :period_end
69
- # string :currency
70
- # integer :starting_balance
71
- # integer :ending_balance
72
- # string :charge_id
73
- # integer :discount
74
- # datetime :next_payment_attempt
75
- #=¡=#>>>
76
56
  end
57
+ #=!=#
58
+ # ==Database Schema
59
+ #
60
+ # string :id
61
+ # string :customer_id
62
+ # integer :amount_due
63
+ # integer :subtotal
64
+ # integer :total
65
+ # boolean :attempted
66
+ # integer :attempt_count
67
+ # boolean :paid
68
+ # boolean :closed
69
+ # datetime :date
70
+ # datetime :period_start
71
+ # datetime :period_end
72
+ # string :currency
73
+ # integer :starting_balance
74
+ # integer :ending_balance
75
+ # string :charge_id
76
+ # integer :discount
77
+ # datetime :next_payment_attempt
78
+ #=¡=#
77
79
  end
@@ -24,8 +24,8 @@ module StripeLocal
24
24
  attrs.each_with_object({}) do |(k,v),h|
25
25
  key = case k.to_sym
26
26
  when :invoice then :invoice_id
27
- when :plan then h[:plan_id] = v.id and next
28
- when :metadata then h[:metadata] = MultiJson.dump( v.to_hash ) and next
27
+ when :plan then h[:plan_id] = ( v.nil? ? "" : v.id ) and next # will be nil if this is a one off charge
28
+ when :metadata then h[:metadata] = MultiJson.dump( v.try :to_hash ) and next
29
29
  when :type then h[:subscription] = (v == "subscription" ? true : false) and next
30
30
  when :period then h[:period_start] = Time.at(v.start) and h[:period_end] = Time.at(v.end) and next
31
31
  when ->(x){attribute_method? x} then k.to_sym
@@ -36,19 +36,21 @@ module StripeLocal
36
36
  end
37
37
  end
38
38
 
39
- #=!=#>>>
40
- # string :id
41
- # string :invoice_id
42
- # boolean :subscription
43
- # integer :amount
44
- # string :currency
45
- # boolean :proration
46
- # datetime :period_start
47
- # datetime :period_end
48
- # integer :quantity
49
- # string :plan_id
50
- # string :description
51
- # text :metadata
52
- #=¡=#>>>
53
39
  end
40
+ #=!=#
41
+ # ==Database Schema
42
+ #
43
+ # string :id
44
+ # string :invoice_id
45
+ # boolean :subscription
46
+ # integer :amount
47
+ # string :currency
48
+ # boolean :proration
49
+ # datetime :period_start
50
+ # datetime :period_end
51
+ # integer :quantity
52
+ # string :plan_id
53
+ # string :description
54
+ # text :metadata
55
+ #=¡=#
54
56
  end
@@ -1,3 +1,3 @@
1
1
  module StripeLocal
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end