Questions tagged [httparty]

HTTParty is a Ruby gem written by John Nunemaker focused on the consumption of web services and APIs.

HTTParty is a Ruby gem written by John Nunemaker focused on the consumption of web services and APIs. It boasts a very readable DSL and out-of-the-box support for JSON, HTML and XML.

For more information refer to: It's an HTTParty and Everyone Is Invited!

621 questions
0
votes
2 answers

Unable to decode request as valid JSON using RUBY

I am making the following API GET request, using ruby 1.9.3 and the httparty gem: uri= HTTParty.post("www.surveys.com/api/v2/contacts", :basic_auth => auth, :headers => { 'ContentType' => 'application/json' }, :body => { "custom_test" => test, …
Luigi
  • 5,443
  • 15
  • 54
  • 108
0
votes
1 answer

Invalid content type: application/x-www-form-urlencoded on request using httparty

I'm sending a post request to intuit(merchant account) using httparty gem. Here's my code: header = {"Content-Type" => "application/xml", "content-length" => request.length }; options = { :body => request,:options=>{ :headers…
Sachin Prasad
  • 5,365
  • 12
  • 54
  • 101
0
votes
1 answer

Issue accessing hash inside of an array with Ruby

I have set out on the task of learning ruby/rails and accessing API's with Ruby. I have a quick question: I am making a GET request which returns JSON. Once I get that JSON back I need to be able to organize it so I can pull out what I…
user2601288
0
votes
1 answer

Trouble running httparty in rails 4.0 with ruby 2.0

To include httparty in my rails 4.0.0 app, in my gemfile I wrote: gem 'httparty' and then ran bundle install Next in my application.rb file, I inserted this: module myApp class Application < Rails::Application ### --- config.gem…
Amit Erandole
  • 11,995
  • 23
  • 65
  • 103
0
votes
2 answers

Saving rake task in database to add in view

I am trying to save a rake task into my database to I can display the content in my view. Here's the task: desc "Fetch Digital Trends" task :fetch_trends => :environment do require 'nokogiri' require 'httparty' url =…
Dan Mitchell
  • 844
  • 2
  • 15
  • 34
0
votes
1 answer

Design decisions when writing an API wrapper with HTTParty in Ruby

I'm writing an API wrapper in Ruby and not sure how to proceed. HTTParty is very nice and takes care of everything for me, but on HTTParty::get it returns an HTTParty::Response object. I want to know, is it better to: Let the user work with the…
DillPixel
  • 955
  • 1
  • 14
  • 20
0
votes
1 answer

Rails: timeout after doing HTTP POST from controller

Rails 3.1.3, ruby 1.9.3p374 I am trying to POST from a controller (which receives data via POST from client and then does some processing first) to another controller in the app, and am getting Timeout::Error. I have tried using Net::HTTP (long form…
rrw4
  • 61
  • 2
0
votes
2 answers

How do I print a specific value from a JSON response?

I am trying to use forvo.com's API. I ran this in the console: response = HTTParty.get('http://apifree.forvo.com/key/XXXXXXXXXXXXXXX/format/json/action/standard-pronunciation/word/%E4%BD%A0%E5%A5%BD/language/zh') This is the response: { "items"…
webmagnets
  • 2,266
  • 3
  • 33
  • 60
0
votes
1 answer

Accessing Pingdom API with HTTParty from Rails

Hi there i have a problem while accessing Pingdom API from my rails app. Here is the code: auth = {:username => pingdom_username, :password => pingdom_password, :key => application_key } response…
Dragan
  • 500
  • 3
  • 11
0
votes
1 answer

Post destination receive put data 2 times in parameters

I'm developping a post to a callback url in Ruby on Rails and use the Httparty library for this, I receive the post perfectly on the url but it seems that rails convert the data that is pushed to the url 2 times to parameters. Here is the code that…
SteenhouwerD
  • 1,819
  • 1
  • 16
  • 22
0
votes
3 answers

upload file to box api v2

i am trying to upload a file to box.com with their v2 api. i am able to successfully upload a file with curl, but cannot upload a file from my rails application. i am passing my upload function the correct folder id and file is a tempfile object…
Austin
  • 1,129
  • 2
  • 11
  • 18
0
votes
1 answer

Accessing an API

I'm trying to build a Rails app where I have to access the Zomato API Could anybody guide me on how to create the Controller and View. Suppose I want to get the name of the restaurant from this URL: Restaurant, how do I write the controller and…
0
votes
1 answer

problems with a anti-robot system requesting site with httparty

I have a problem requesting website with httparty gem: anti-bot system responds me with some boring stuff ) does httparty have any standart methods to alter request headers(I mean UserAgent, etc.)? or can it be done in other way?
Roaring Stones
  • 1,054
  • 7
  • 22
0
votes
2 answers

HTTParty.get with callback causes MultiJson::DecodeError.

I'm using HTTParty to make calls to an API. When I have callback in the url it causes MultiJson::DecodeError: MultiJson::DecodeError in PagesController#home 756: unexpected token at…
Anders
  • 2,903
  • 7
  • 58
  • 114
0
votes
1 answer

Resolving Sinatra and HTTParty method name clashes

In my Sinatra app, I am using a class with HTTParty as mixin. class A include HTTParty format :json def fetch arguments get(:query => arguments) end end When I try to call the fetch (when the class instance is created inside a get…
skazhy
  • 4,421
  • 7
  • 30
  • 32