itunes_receipt_decoder 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ee14ef362c8cbcea6ff0c44ecd75e99b0b5095f
4
- data.tar.gz: bf0d7e7bf9280a8d0db9d4c7293550c1e7d11511
3
+ metadata.gz: 1f91cdd0877d05e706d5620f7bf29f871ab656f3
4
+ data.tar.gz: ce718feed167486e498dcbc417a410058505c6c5
5
5
  SHA512:
6
- metadata.gz: 81bc63bfbd525b90bbbea5a15b627d37e1c43ae7a962bdcbc5fbdfe2810e982e3ebd17dd05a1b902129097a11f70fd5718233521b8c90db3ba476c78f11e595a
7
- data.tar.gz: ae515c200465fbe997cc6282b47b8897f9f6af9634ade1a6759ce625ac3de6b63e13e58a97ae9decfbbd9f88e18feb8c7f0addccbca35fb0d300537b34474974
6
+ metadata.gz: 269eb5b5315bf31c5318ab7f7236972e81d4dc76f826d1aebdad422355468a104ca1f2b72c5ea7c26688c90d0ed81619354fe30bd7ddd7e7399c585b5d6f3118
7
+ data.tar.gz: b1cdc45f24929b77c82e75bbfaf068797df9ef46de591795a4f08e0b00f5c92486a29e6e4564a37aaeb312811da23f5b3784db71066657b98f4777f66a1a70e7
@@ -12,6 +12,8 @@ require 'itunes_receipt_decoder/decode/unified_receipt'
12
12
  module ItunesReceiptDecoder
13
13
  class DecodingError < StandardError; end
14
14
 
15
+ PLIST_REGEX = /(\{(?=.+?\bsignature\b.+?)(?=.+?\bpurchase-info\b.+?).+?\})/m
16
+
15
17
  ##
16
18
  # Initializes either ItunesReceiptDecoder::Decode::Transaction or
17
19
  # ItunesReceiptDecoder::Decode::Unified with the base64 encoded receipt
@@ -24,8 +26,8 @@ module ItunesReceiptDecoder
24
26
  rescue ArgumentError => e
25
27
  raise DecodingError, e.message
26
28
  else
27
- if /^\{*+\}$/ =~ raw_receipt
28
- Decode::TransactionReceipt.new(raw_receipt, options)
29
+ if (match = raw_receipt.match(PLIST_REGEX))
30
+ Decode::TransactionReceipt.new(match[0], options)
29
31
  else
30
32
  Decode::UnifiedReceipt.new(raw_receipt, options)
31
33
  end
@@ -3,5 +3,5 @@
3
3
  module ItunesReceiptDecoder
4
4
  ##
5
5
  # Gem version
6
- VERSION = '0.2.1'
6
+ VERSION = '0.2.2'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itunes_receipt_decoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - mbaasy.com