Saturday, 15 August 2015

Httparty in rails -



Httparty in rails -

i trying larn how utilize httparty. ran 'gem install httparty', first in terminal, expecting able utilize in pry session no luck.

next, created new rails app, added gem gem file , ran bundle , in pry session tried utilize httparty follows:

[1] pry(main)> httparty.get("http://rubygems.org/api/v1/versions/httparty.json") nameerror: uninitialized constant httparty (pry):1:in `__pry__' [2] pry(main)> httparty.get("http://rubygems.org/api/v1/versions/httparty.json) [2] pry(main)* httparty.get("http://rubygems.org/api/v1/versions/httparty.json) syntaxerror: unexpected tidentifier, expecting ')' httparty.get("http://rubygems.org/api/v1/versions/httparty.json) ^ [2] pry(main)> httparty.get("http://rubygems.org/api/v1/versions/httparty.json") nameerror: undefined local variable or method `httparty' main:object (pry):2:in `__pry__' [3] pry(main)> response = httparty.get("http://rubygems.org/api/v1/versions/httparty.json") nameerror: undefined local variable or method `httparty' main:object (pry):3:in `__pry__' [4] pry(main)> response = httparty.get('https://api.stackexchange.com/2.2/questions?site=stackoverflow') nameerror: uninitialized constant httparty (pry):4:in `__pry__'

any help much appreciated. give thanks you

i working on exact same thing right now. did create file test_party.rb in rails lib directory. (make sure add together config.autoload_paths += %w(#{config.root}/lib) config/application.rb

in new lib file create class testparty , include httparty

then in rails console can run testparty.whatever_you_want

hope helps!

ruby-on-rails

No comments:

Post a Comment