hrysd / washbullet

Ruby client of Pushbullet API
MIT License
43 stars 16 forks source link

JSON Parse Error #11

Closed wendy0402 closed 8 years ago

wendy0402 commented 8 years ago

I try to do push_note, but get this result:

JSON::ParserError: A JSON text must at least contain two octets!

here is my code:

client = Washbullet::Client.new('someR4nD0mK3y')
client.push_note(receiver: :device, identifier: 'test', params:{title: 'test', body:  'test'})

it seems you change a lot for the arguments of push_note from version 0.3.1

hrysd commented 8 years ago

Hi, Thank you for reporting issue.

Could you paste stack trace on here?

wendy0402 commented 8 years ago
       A JSON text must at least contain two octets!
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/json-1.8.3/lib/json/common.rb:155:in `initialize'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/json-1.8.3/lib/json/common.rb:155:in `new'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/json-1.8.3/lib/json/common.rb:155:in `parse'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/washbullet-0.4.0/lib/washbullet/parse_json.rb:6:in `on_complete'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/response.rb:9:in `block in call'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/response.rb:57:in `on_complete'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/response.rb:8:in `call'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/washbullet-0.4.0/lib/washbullet/authorization.rb:8:in `call'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/request/url_encoded.rb:15:in `call'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/request/multipart.rb:14:in `call'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/faraday-0.9.1/lib/faraday/connection.rb:177:in `post'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/washbullet-0.4.0/lib/washbullet/request.rb:18:in `request'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/washbullet-0.4.0/lib/washbullet/request.rb:8:in `post'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/washbullet-0.4.0/lib/washbullet/pushable.rb:28:in `push'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/washbullet-0.4.0/lib/washbullet/pushable.rb:10:in `push'
      /Users/my_name/.rvm/gems/ruby-2.1.5/gems/washbullet-0.4.0/lib/washbullet/api/pushes.rb:10:in `push_note'
      ./lib/observer/push_bullet_notifier.rb:12:in `block in update'
      ./lib/observer/push_bullet_notifier.rb:10:in `each'
      ./lib/observer/push_bullet_notifier.rb:10:in `update'
      ./spec/lib/observer/push_bullet_notifier_spec.rb:20:in `block (3 levels) in <top (required)>'
wendy0402 commented 8 years ago

Hey @hrysd I don't realize that I make a stub request and don't return anything. Hence the json_parse.rb cannot parse it. sorry about that. Thanks for your fast response by the way. :smile:

hrysd commented 8 years ago

I'm glad to hear that!!