amazon-iap 0.1.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -28,18 +28,25 @@ for more details.
28
28
  Initialize a client, passing in the developer secret and (optionally) the host. If a host is not
29
29
  passed, it will use Amazon's production endpoint.
30
30
 
31
- client = Amazon::Iap::Client.new 'my_developer_secret', 'http://iap-staging.domain.com'
31
+ ```ruby
32
+ client = Amazon::Iap::Client.new 'my_developer_secret', 'http://iap-staging.domain.com' # staging server
33
+ client = Amazon::Iap::Client.new 'my_developer_secret' # production server
34
+ ```
32
35
 
33
36
  From there, you can call either `verify` or `renew` on the client and pass in the user id and purchase token:
34
37
 
35
- result = client.verify 'some-user-id', 'some-purchase-token'
36
- result = client.renew 'some-user-id', 'some-purchase-token'
38
+ ```ruby
39
+ result = client.verify 'some-user-id', 'some-purchase-token'
40
+ result = client.renew 'some-user-id', 'some-purchase-token'
41
+ ```
37
42
 
38
43
  By default, the `verify` method will automatically try to renew expired tokens, and will recall `verify`
39
44
  against the new token returned. If you do not want this behavior, simply pass in `false` as the third
40
45
  attribute to the `verify` method:
41
46
 
42
- result = client.verify 'some-user-id', 'some-purchase-token', false
47
+ ```ruby
48
+ result = client.verify 'some-user-id', 'some-purchase-token', false
49
+ ```
43
50
 
44
51
  ## Returned Values
45
52
 
@@ -47,23 +54,27 @@ An instance of Amazon::Iap::Result is returned from both methods, the attributes
47
54
  of the hash keys returned in the JSON object. For convenience, we also add `start_time` and `end_time` attributes
48
55
  which are `Time` representations of the milliseconds returned in `start_date` and `end_date` respectively. E.g.,
49
56
 
50
- result = client.verify 'some-user-id', 'some-purchase-token'
51
-
52
- result.class.name # "Amazon::Iap::Result"
53
- result.item_type # "SUBSCRIPTION"
54
- result.sku # "some-sku"
55
- result.start_date # 1378751554943
56
- result.start_time # 2013-09-09 14:32:34 -0400
57
- result.end_date # nil
58
- result.end_time # nil
59
- result.purchase_token # "some-purchase-token"
57
+ ```ruby
58
+ result = client.verify 'some-user-id', 'some-purchase-token'
59
+
60
+ result.class.name # "Amazon::Iap::Result"
61
+ result.item_type # "SUBSCRIPTION"
62
+ result.sku # "some-sku"
63
+ result.start_date # 1378751554943
64
+ result.start_time # 2013-09-09 14:32:34 -0400
65
+ result.end_date # nil
66
+ result.end_time # nil
67
+ result.purchase_token # "some-purchase-token"
68
+ ```
60
69
 
61
70
  <!-- -->
62
-
63
- result = client.renew 'some-user-id', 'some-purchase-token'
64
-
65
- result.class.name # "Amazon::Iap::Result"
66
- result.purchase_token # "some-new-purchase-token"
71
+
72
+ ```ruby
73
+ result = client.renew 'some-user-id', 'some-purchase-token'
74
+
75
+ result.class.name # "Amazon::Iap::Result"
76
+ result.purchase_token # "some-new-purchase-token"
77
+ ```
67
78
 
68
79
  ## Exception Handling
69
80
 
@@ -72,11 +83,13 @@ a distinct exception. Take a look at the [Amazon::Iap::Result class](lib/amazon
72
83
 
73
84
  Example exception handling:
74
85
 
75
- begin
76
- result = client.verify 'some-user-id', 'some-purchase-token'
77
- rescue Amazon::Iap::Exceptions::InternalError => e
78
- # enqueue to try again later
79
- end
86
+ ```ruby
87
+ begin
88
+ result = client.verify 'some-user-id', 'some-purchase-token'
89
+ rescue Amazon::Iap::Exceptions::InternalError => e
90
+ # enqueue to try again later
91
+ end
92
+ ```
80
93
 
81
94
  ## Contributing
82
95
 
@@ -1,13 +1,14 @@
1
1
  module Amazon
2
2
  module Iap
3
3
  module Exceptions
4
- class InvalidTransaction < Exception; end
5
- class InvalidSharedSecret < Exception; end
6
- class InvalidUserId < Exception; end
7
- class InvalidPurchaseToken < Exception; end
8
- class ExpiredCredentials < Exception; end
9
- class InternalError < Exception; end
10
- class General < Exception; end
4
+ class Exception < Exception; end
5
+ class InvalidTransaction < Amazon::Iap::Exceptions::Exception; end
6
+ class InvalidSharedSecret < Amazon::Iap::Exceptions::Exception; end
7
+ class InvalidUserId < Amazon::Iap::Exceptions::Exception; end
8
+ class InvalidPurchaseToken < Amazon::Iap::Exceptions::Exception; end
9
+ class ExpiredCredentials < Amazon::Iap::Exceptions::Exception; end
10
+ class InternalError < Amazon::Iap::Exceptions::Exception; end
11
+ class General < Amazon::Iap::Exceptions::Exception; end
11
12
  end
12
13
  end
13
14
  end
@@ -1,5 +1,5 @@
1
1
  module Amazon
2
2
  module Iap
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazon-iap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-11 00:00:00.000000000 Z
12
+ date: 2013-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler