getonbrd / pipedrive-connect

Ruby library for the Pipedrive API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when a deal has no subscription and Pipedrive::Subscription.find_by_deal is called

njcameron opened this issue · comments

Steps to reproduce:

  • Call Pipedrive::Subscription.find_by_deal 123 where 123 is a deal ID of a deal without a subscription
  • Observer error JSON::ParserError: 859: unexpected token at ''

Example response from Pipedrive API

#<Faraday::Response:0x000000010f4fba40
 @env=
  #<struct Faraday::Env
   method=:get,
   request_body=nil,
   url=#<URI::HTTPS https://api.pipedrive.com/v1/subscriptions/find/134?api_token=xxx>,
   request=
    #<struct Faraday::RequestOptions
     params_encoder=nil,
     proxy=nil,
     bind=nil,
     timeout=nil,
     open_timeout=nil,
     read_timeout=nil,
     write_timeout=nil,
     boundary=nil,
     oauth=nil,
     context=nil,
     on_data=nil>,
   request_headers={"Content-type"=>"application/json", "User-Agent"=>"Faraday v1.10.2"},
   ssl=
    #<struct Faraday::SSLOptions
     verify=true,
     ca_file=nil,
     ca_path=nil,
     verify_mode=nil,
     cert_store=nil,
     client_cert=nil,
     client_key=nil,
     certificate=nil,
     private_key=nil,
     verify_depth=nil,
     version=nil,
     min_version=nil,
     max_version=nil>,
   parallel_manager=nil,
   params=nil,
   response=#<Faraday::Response:0x000000010f4fba40 ...>,
   response_headers=
    {"date"=>"Tue, 18 Oct 2022 19:44:34 GMT",
     "connection"=>"keep-alive",
     "cf-ray"=>"75c3c4f8c890892a-LHR",
     "cache-control"=>"no-cache",
     "strict-transport-security"=>"max-age=31536000; includeSubDomains",
     "cf-cache-status"=>"DYNAMIC",
     "access-control-expose-headers"=>"X-RateLimit-Remaining, X-RateLimit-Limit, X-RateLimit-Reset",
     "badi"=>"Routing: lon-1=>lon-1; Version: 6c1f; Host: bari;",
     "content-security-policy"=>
      "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests",
     "expect-ct"=>"max-age=0",
     "referrer-policy"=>"no-referrer",
     "x-content-type-options"=>"nosniff",
     "x-correlation-id"=>"05170582-eb94-4a54-ae5f-11ae7f0f6e43",
     "x-dns-prefetch-control"=>"off",
     "x-download-options"=>"noopen",
     "x-frame-options"=>"SAMEORIGIN",
     "x-permitted-cross-domain-policies"=>"none",
     "x-ratelimit-limit"=>"40",
     "x-ratelimit-remaining"=>"39",
     "x-ratelimit-reset"=>"2",
     "x-xss-protection"=>"0, 1; mode=block",
     "set-cookie"=>
      "__cf_bm=7r3lRUGQaoPJstDSFFHDlU_hyV_PLiJaz3RfrV9qzZg-1666122274-0-ARbMOavaNv/AWNHSfTitqokXEN1TPAuP7SnialIhgOGNJ8JL8XgaTEWxMiL5mh0bvQI8zTpEEC4QYBQqx7WpJvE=; path=/; expires=Tue, 18-Oct-22 20:14:34 GMT; domain=.pipedrive.com; HttpOnly; Secure; SameSite=None",
     "vary"=>"Accept-Encoding",
     "server"=>"cloudflare",
     "alt-svc"=>"h3=\":443\"; ma=86400, h3-29=\":443\"; ma=86400"},
   status=204,
   reason_phrase="No Content",
   response_body="">,
 @on_complete_callbacks=[]>