Comments (14)
I have the same error here.
from itunes-receipt.
I have no idea.
It seems receipt_attributes
is an Array in your case.
Can you inspect receipt_attributes
instance?
from itunes-receipt.
I already checked it out and the problem is that apple returns in some cases (i think auto-renewable-subscription receipts) "latest_receipt_info" as an array, but its expected to be an object.
from itunes-receipt.
does it relate to line 54?
@adam_id = receipt_attributes[:adam_id]
from itunes-receipt.
Not it does not really relate to 54. Its because of the line 73.
attributes[:latest_receipt_info]
is an array in this case instead of the object, and so you are initializing the same class (Receipt
) again, but you pass a array as receipt
instead of the expected object. And then it goes into the initialize
method again, but this time with an array.
I uploaded the receipt that i get from Apple: https://gist.github.com/philipgiuliani/b63b22309d04048f0827
In this case @latest
should return an Array of Receipt
's instead of a single Receipt
You think you could do a quick fix?
from itunes-receipt.
Ah, I got it.
I haven't play with "auto-renewable-subscription receipts", but if the latest receipt info is always an array for such receipts, I'll just make @latest
an array.
Do you guys think that my solution will solve your errors?
from itunes-receipt.
Yes that will defently solve our problems. Just for backward compability, i would only make it an array if : latest_receipt_info
is a Array.
from itunes-receipt.
I've just released v1.1.0 with this change.
77c0b4d
Thanks for your help!
from itunes-receipt.
Thanks to you for the quick update.
from itunes-receipt.
Are the changes tested? For me receipt.latest.inspect
returns nil
when i pass the following json :(
json = JSON.parse(content of https://gist.github.com/philipgiuliani/b63b22309d04048f0827)
receipt = Itunes::Receipt.new(json)
puts receipt.latest.inspect
Any idea why thats nil?
from itunes-receipt.
I guess it's because the Hash keys are String, not Symbol.
from itunes-receipt.
Havent thought about that yet. I will try out symbolize_keys later :)
Nov Matake [email protected] schrieb am Do., 13. Nov. 2014 15:09:
I guess it's because the Hash keys are String, not Symbol.
—
Reply to this email directly or view it on GitHub
#12 (comment).
from itunes-receipt.
Fixed it, symbolize_keys wasn't the issue, i just had to set .with_indifferent_access
json = JSON.parse(content of https://gist.github.com/philipgiuliani/b63b22309d04048f0827)
receipt = Itunes::Receipt.new(json.with_indifferent_access)
puts receipt.latest.inspect
from itunes-receipt.
new version totally solves the problem. Thanks !
from itunes-receipt.
Related Issues (8)
- No support for cancellation date? HOT 2
- `expires_date` field is invalid for auto-renewable subscriptions HOT 2
- Add support for `cancellation_date` field HOT 1
- RestClient::SSLCertificateNotVerified Error HOT 3
- Where to set Shared secrent for Auto renewal subscriptions? HOT 2
- JSON Conversion is broken
- JSON Conversion Missing Data HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from itunes-receipt.