Comments (8)
Temporary workaround:
In Gemfile
use my fork:
# Patreon
gem 'patreon', git: 'https://github.com/hovancik/patreon-ruby', branch: 'feature/remove-json-api-vanilla'
Then update your code to not use broken json-api-vanilla
, ie to get all your patron IDs:
api_client = Patreon::API.new(ENV.fetch('PATREON_ACCESS_TOKEN'))
campaign_response = api_client.fetch_campaign
campaign_id = campaign_response['data'][0]['id']
all_pledges = []
cursor = nil
loop do
page_response = api_client.fetch_page_of_pledges(campaign_id, count: 25, cursor: cursor)
all_pledges += page_response['data']
next_page_link = page_response['links']['next']
break unless next_page_link
parsed_query = CGI::parse(next_page_link)
cursor = parsed_query['page[cursor]'][0]
end
all_pledges.map { |pledge| pledge['relationships']['patron']['data']['id'] }
from patreon-ruby.
Thanks @hovancik . I was getting crazy with the Vanilla parse. This workaround works great.
from patreon-ruby.
Hey, I just tried out the example and hit an error. I updated the url to use /api instead, and now it's working (for me at least). The pull request is over here #8. Can you try this out and let me know if it fixes it for you?
from patreon-ruby.
Hey, actually, I don't think that will help you. Instead, if possible can you run with DEBUG=1
set in your env (and use master of this gem). It will capture some debug output, and then, if you don't mind using some secure method, or cutting out the tokens, I think that will help us track down the issue.
from patreon-ruby.
Seeing this issue as well. Using master branch from github didn't help.
from patreon-ruby.
Getting this error as well.
@joshbuddy
I re-ran it with DEBUG=1
. I'm not very familiar with these responses and am not sure which parts are sensitive data. Do you have any secure methods you recommend for sharing the output?
from patreon-ruby.
Encountering the same problem here. Appears to be an issue with JSON::Api::Vanilla.parse
. Why not just use native Ruby JSON.parse?
From: /patreon-ruby/lib/patreon/api.rb @ line 34 Patreon::API#get_parse_json:
31: def get_parse_json(suffix)
32: json = get_json(suffix)
33: binding.pry
=> 34: parse_json(json)
35: end
[1] pry(#<Patreon::API>)> json
=> "{\n \"data\": {\n \"attributes\": {\n \"about\": null,\n \"created\": \"2017-03-27T22:39:59+00:00\",\n \"discord_id\": null,\n \"email\": \"[email protected]\",\n \"facebook\": null,\n \"facebook_id\": null,\n \"first_name\": \"Greenspud\",\n \"full_name\": \"Greenspud Trades\",\n \"gender\": 0,\n \"has_password\": true,\n \"image_url\": \"https://c10.patreonusercontent.com/3/eyJ2IjoiMSIsInciOjIwMH0%3D/patreon-media/user/5462977/a152f52e08ec4099b3212547e377a954?token-time=2145916800&token-hash=96pPoipGZzm6gTSV1dzdQsuIr47TbCzn1wzvW_7UAog%3D\",\n \"is_deleted\": false,\n \"is_email_verified\": true,\n \"is_nuked\": false,\n \"is_suspended\": false,\n \"last_name\": \"Trades\",\n \"social_connections\": {\n \"deviantart\": null,\n \"discord\": null,\n \"facebook\": null,\n \"spotify\": null,\n \"twitch\": null,\n \"twitter\": null,\n \"youtube\": null\n },\n \"thumb_url\": \"https://c10.patreonusercontent.com/3/eyJoIjoxMDAsInYiOiIxIiwidyI6MTAwfQ%3D%3D/patreon-media/user/5462977/a152f52e08ec4099b3212547e377a954?token-time=2145916800&token-hash=FioodKfrYEtzdXUmk5EXJ8KpY3PIKtJFeG6HaIbjZJA%3D\",\n \"twitch\": null,\n \"twitter\": null,\n \"url\": \"https://www.patreon.com/greenspudtrades\",\n \"vanity\": \"greenspudtrades\",\n \"youtube\": null\n },\n \"id\": \"5462977\",\n \"relationships\": {\n \"pledges\": {\n \"data\": []\n }\n },\n \"type\": \"user\"\n },\n \"links\": {\n \"self\": \"https://www.patreon.com/api/user/5462977\"\n }\n}"
[3] pry(#<Patreon::API>)> JSON::Api::Vanilla.parse(json)
NoMethodError: undefined method `pledges=' for nil:NilClass
from patreon-ruby.
Can confirm that this is issue with JSON::Api::Vanilla.parse
. I have the same issue in another place #23
JSON::Api::Vanilla
has issue opened trainline/json-api-vanilla#4 from some time ago.
Patreon should drop this dependency.
from patreon-ruby.
Related Issues (7)
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 patreon-ruby.