helu 0.3 → 0.3.1
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 +6 -14
- data/README.md +23 -5
- data/lib/project/helu.rb +15 -9
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
YTY3M2ZjOTM4MThjZmYzZWNmNzQ1NzE5MGM3YWYzNGFjYTI5Yjg1NTU0OTQx
|
10
|
-
ZDg5ZGU0NTAzMzE5NGJiMWNiNmI2NWI5YmMyMDE1NTE0YTllN2JkNzJmNzE3
|
11
|
-
MDIyYmNkNmQxODg4MGJlMjMwNzk1MWFjOTkyNzFlOTk4ZDc1MTA=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZjRiZDBmODljYmNkYzZkMDM3ZWRjYzAyYjMxZmUzOGIyZjk2MDU5ODVlNzVj
|
14
|
-
NDc5OWRkMzkzYTZhOWMzMWRlMzJkMGNkNTA2ZWE3YjU0ZGI1OTA0YTMwNjcx
|
15
|
-
ODg1N2U2MmVjZmZjZDk4YmIxMzY5YjhiZGJiYmQ3MTdiYzE5YjY=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dd16fb8348af027762051e2ae46369e293b845b6
|
4
|
+
data.tar.gz: 23ba3a3f9ecbf344cf55f63a96d5c1acc6155879
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 75547bc6258890a999f3d3b97e29adbc863bde388232e6872e26ddb7874db17e99bcc20989c38b763ca14e3d5f34346980316051268d2ccdd0a14b2e2f31f17d
|
7
|
+
data.tar.gz: 33c1ec1f4204156759dceb2658968b4204d5cf8f9ba7e52066b0b27ee4413fc4e36d3770ef8f4779e1b3aed07a9c44e71120d970cbcde15dbd4d58a16ce22040
|
data/README.md
CHANGED
@@ -23,12 +23,30 @@ Start a helu with the In App Purchase ID:
|
|
23
23
|
|
24
24
|
#### create blocks for failing and buying:
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
@helu.fail = lambda { |transaction| puts transaction ; # node here for failed in app purchase }
|
27
|
+
@helu.winning = lambda { |transaction| puts transaction ; # code here for successful in app purchase }
|
28
|
+
|
29
|
+
|
30
|
+
The transaction object on the lambda is the one we get from Apple; Therefore, it is a SKPaymentTransaction. [More information about it here](http://developer.apple.com/library/ios/#documentation/StoreKit/Reference/SKPaymentTransaction_Class/Reference/Reference.html)
|
31
|
+
|
28
32
|
|
29
|
-
@helu.fail = fail_block
|
30
|
-
@helu.winning = winning_block
|
31
33
|
|
32
34
|
#### buy the product:
|
33
35
|
|
34
|
-
@helu.buy
|
36
|
+
@helu.buy
|
37
|
+
|
38
|
+
|
39
|
+
Make sure that if your code ever throws out the Helu object, it better also close the store before doing so.
|
40
|
+
|
41
|
+
@helu.close_the_store
|
42
|
+
|
43
|
+
|
44
|
+
## Example App:
|
45
|
+
|
46
|
+
[You can find an example app here](https://github.com/ivanacostarubio/helu-example). Remember that for this to work properly, you must add your app identifier to the Rakefile.
|
47
|
+
|
48
|
+
|
49
|
+
## Supported types of In App Purchases
|
50
|
+
|
51
|
+
+ Consumables and Non-Consumables are supported.
|
52
|
+
+ Auto-Renewable subscriptions and Non-Renewing Subscriptions are not supported yet. However, we would love some help making it happen.
|
data/lib/project/helu.rb
CHANGED
@@ -4,7 +4,11 @@ class Helu
|
|
4
4
|
|
5
5
|
def initialize(product_id)
|
6
6
|
@product_id = product_id
|
7
|
-
|
7
|
+
SKPaymentQueue.defaultQueue.addTransactionObserver(self)
|
8
|
+
end
|
9
|
+
|
10
|
+
def close_the_store
|
11
|
+
SKPaymentQueue.defaultQueue.removeTransactionObserver(self)
|
8
12
|
end
|
9
13
|
|
10
14
|
def fail=(fail_block)
|
@@ -52,14 +56,16 @@ class Helu
|
|
52
56
|
|
53
57
|
def paymentQueue(queue,updatedTransactions:transactions)
|
54
58
|
transactions.each do |transaction|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
if transaction.payment.productIdentifier == @product_id
|
60
|
+
case transaction.transactionState
|
61
|
+
when SKPaymentTransactionStatePurchased
|
62
|
+
completeTransaction(transaction)
|
63
|
+
when SKPaymentTransactionStateFailed
|
64
|
+
failedTransaction(transaction)
|
65
|
+
when SKPaymentTransactionStateRestored
|
66
|
+
restoreTransaction(transaction)
|
67
|
+
else
|
68
|
+
end
|
63
69
|
end
|
64
70
|
end
|
65
71
|
end
|
metadata
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: helu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Acosta-Rubio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
description:
|
27
|
+
description: 'RubyMotion :: StoreKit Wrapper :: Allows In App Purchases '
|
28
28
|
email:
|
29
29
|
- ivan@bakedweb.net
|
30
30
|
executables: []
|
@@ -44,12 +44,12 @@ require_paths:
|
|
44
44
|
- lib
|
45
45
|
required_ruby_version: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - '>='
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
requirements: []
|