Patreon / patreon-ruby

Interact with the Patreon API via OAuth
Apache License 2.0
36 stars 13 forks source link

NoMethodError (undefined method `campaign=' for nil:NilClass) #23

Open hovancik opened 5 years ago

hovancik commented 5 years ago

Hi,

I am trying to fetch patrons but I am getting errors:

api_client = Patreon::API.new(ENV.fetch('PATREON_ACCESS_TOKEN'))
=> #<Patreon::API:0x0000558727862be0 @access_token="xxx">
irb(main):002:0> campaign_response = api_client.fetch_campaign
opening connection to www.patreon.com:443...
opened
starting SSL for www.patreon.com:443...
SSL established
<- "GET /api/oauth2/api/current_user/campaigns HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: Patreon-Ruby, version 0.5.0, platform x86_64-pc-linux-gnu\r\nAuthorization: Bearer xxx\r\nConnection: close\r\nHost: www.patreon.com\r\n\r\n"
-> "HTTP/1.1 200 OK\r\n"
-> "Date: xxx\r\n"
-> "Content-Type: application/vnd.api+json\r\n"
-> "Transfer-Encoding: chunked\r\n"
-> "Connection: close\r\n"
-> "Set-Cookie: __cfduid=xxx; expires=Wed, XXX GMT; path=/; domain=.patreon.com; HttpOnly; Secure\r\n"
-> "Vary: Accept-Encoding\r\n"
-> "Cache-control: private\r\n"
-> "Set-Cookie: patreon_device_id=xxx; Domain=patreon.com; Expires=Mon, xxxx GMT; Max-Age=630720000; Path=/\r\n"
-> "X-Patreon-UUID: xxx\r\n"
-> "Content-Encoding: gzip\r\n"
-> "Strict-Transport-Security: max-age=2592000\r\n"
-> "X-Content-Type-Options: nosniff\r\n"
-> "Expect-CT: max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"\r\n"
-> "Server: cloudflare\r\n"
-> "CF-RAY:xxx\r\n"
-> "\r\n"
-> "ddf\r\n"
reading 3551 bytes...
-> "\x1F\x8B\b\x00\x00\x00\x00\x00\x00\x03\xE5Z\ts\xD4F\x16\xFE+\x9D\xA9\xDDMR\xEB\x99\xD1}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\xBA\xA6\xE83\xB43C\eY\xDE\xE8\xDA\xFC\xF2\x1C_\vR\xCF\x8F!\x18\xFD\r6!\xF84M\xBDF\xB7G\x8E\xBE_'1\xBE>D\xF0U\x91\b_\x04\"P\xEB\xE1W|\xFBA\xBD@\xB6\xF5N\xEB\x1E\xA1\x11\xBE\xD0\xB7\xA4\xF3\xF2\xCD\xAD-N\xB7\xCF\xE8\x94$k\xE6\xEF0\xB3x\n|\xED3\xD6\xFF\x00\\{\x80z\x8A-\x00\x00"
read 3551 bytes
reading 2 bytes...
-> "\r\n"
read 2 bytes
-> "0\r\n"
-> "\r\n"
Conn close
Traceback (most recent call last):
        1: from (irb):2
NoMethodError (undefined method `campaign=' for nil:NilClass)

when I call it within a background job, I see this error:

undefined method `campaign=' for nil:NilClass
/app/vendor/bundle/ruby/2.5.0/gems/json-api-vanilla-1.0.1/lib/json-api-vanilla/parser.rb:152:in `set_key'
/app/vendor/bundle/ruby/2.5.0/gems/json-api-vanilla-1.0.1/lib/json-api-vanilla/parser.rb:94:in `block (2 levels) in build'
/app/vendor/bundle/ruby/2.5.0/gems/json-api-vanilla-1.0.1/lib/json-api-vanilla/parser.rb:80:in `each'
/app/vendor/bundle/ruby/2.5.0/gems/json-api-vanilla-1.0.1/lib/json-api-vanilla/parser.rb:80:in `block in build'
/app/vendor/bundle/ruby/2.5.0/gems/json-api-vanilla-1.0.1/lib/json-api-vanilla/parser.rb:76:in `each'
/app/vendor/bundle/ruby/2.5.0/gems/json-api-vanilla-1.0.1/lib/json-api-vanilla/parser.rb:76:in `build'
/app/vendor/bundle/ruby/2.5.0/gems/json-api-vanilla-1.0.1/lib/json-api-vanilla/parser.rb:20:in `parse'
/app/vendor/bundle/ruby/2.5.0/gems/patreon-0.5.0/lib/patreon/api.rb:53:in `parse_json'
/app/vendor/bundle/ruby/2.5.0/gems/patreon-0.5.0/lib/patreon/api.rb:33:in `get_parse_json'
/app/vendor/bundle/ruby/2.5.0/gems/patreon-0.5.0/lib/patreon/api.rb:12:in `fetch_campaign'
/app/app/services/patreon/get_patrons_service.rb:7:in `perform'
/app/app/jobs/set_patreon_contributors_job.rb:4:in `perform'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.2/lib/active_job/execution.rb:39:in `block in perform_now'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/i18n-1.5.3/lib/i18n.rb:284:in `with_locale'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.2/lib/active_job/translation.rb:9:in `block (2 levels) in <module:Translation>'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:118:in `instance_exec'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.2/lib/active_job/logging.rb:26:in `block (4 levels) in <module:Logging>'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/notifications.rb:168:in `block in instrument'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/notifications.rb:168:in `instrument'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.2/lib/active_job/logging.rb:25:in `block (3 levels) in <module:Logging>'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.2/lib/active_job/logging.rb:46:in `block in tag_logger'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:71:in `block in tagged'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:28:in `tagged'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb:71:in `tagged'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.2/lib/active_job/logging.rb:46:in `tag_logger'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.2/lib/active_job/logging.rb:22:in `block (2 levels) in <module:Logging>'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:118:in `instance_exec'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:136:in `run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.2/lib/active_job/execution.rb:38:in `perform_now'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.2/lib/active_job/execution.rb:24:in `block in execute'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.2/lib/active_job/railtie.rb:28:in `block (4 levels) in <class:Railtie>'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/execution_wrapper.rb:87:in `wrap'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/reloader.rb:73:in `block in wrap'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/execution_wrapper.rb:87:in `wrap'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/reloader.rb:72:in `wrap'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.2/lib/active_job/railtie.rb:27:in `block (3 levels) in <class:Railtie>'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:118:in `instance_exec'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:136:in `run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.2/lib/active_job/execution.rb:22:in `execute'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.2/lib/active_job/queue_adapters/delayed_job_adapter.rb:42:in `perform'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/backend/base.rb:81:in `block in invoke_job'
/app/vendor/bundle/ruby/2.5.0/gems/rollbar-2.18.2/lib/rollbar/plugins/delayed_job/plugin.rb:39:in `block in invoke_job_callback'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block in add'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/backend/base.rb:78:in `invoke_job'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:230:in `block (2 levels) in run'
/app/vendor/ruby-2.5.3/lib/ruby/2.5.0/timeout.rb:93:in `block in timeout'
/app/vendor/ruby-2.5.3/lib/ruby/2.5.0/timeout.rb:103:in `timeout'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:230:in `block in run'
/app/vendor/ruby-2.5.3/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:229:in `run'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:312:in `block in reserve_and_run_one_job'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:312:in `reserve_and_run_one_job'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:213:in `block in work_off'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:212:in `times'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:212:in `work_off'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:175:in `block (4 levels) in start'
/app/vendor/ruby-2.5.3/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:174:in `block (3 levels) in start'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:173:in `block (2 levels) in start'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:172:in `loop'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:172:in `block in start'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block in add'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:171:in `start'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/tasks.rb:9:in `block (2 levels) in <main>'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.5.3/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/application.rb:160:in `invoke_task'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `each'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block in top_level'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/application.rb:125:in `run_with_threads'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/application.rb:110:in `top_level'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/application.rb:83:in `block in run'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/lib/rake/application.rb:80:in `run'
/app/bin/rake:9:in `<main>'
hovancik commented 5 years ago

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'] }