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
3
votes
1 answer

how to organize outgoing api request urls in rails

I have an application in rails that make request to other microservices using httparty. Other microservices are also written in Rails. Right now, i hard coded all the api urls used in httparty, what will be a more elegant way to organize them?
sean an
  • 127
  • 1
  • 2
  • 12
3
votes
1 answer

HTTParty headers not working in ruby script

I am trying to get the following curl command (which works) replicated in some Ruby code, however the 'Customer-Id' header part seems to not get sent/picked up by the API. The curl command is: curl -u ‘me@mydomain.com’ -H ‘Customer-Id: 243’…
DerRabe
  • 313
  • 1
  • 3
  • 6
3
votes
1 answer

Ruby gem is overriding standard library

When trying to create a new ruby logger: logger = Logger.new('my.log') I'm getting an error: NoMethodError: undefined method `new' for HTTParty::Logger:Module Creating the logger from the Rails Console works fine. When trying to create it from the…
singularity
  • 573
  • 4
  • 15
3
votes
1 answer

Undefined method `OAuth' when making HTTP request to Twitter api

I'm getting the following OAuth error when trying to make a request to the Twitter streaming api: "#NoMethodError: undefined method `OAuth' for #TwitterMoment:0x007fa081d821f0" def query authorisation_header = OAuth…
amesimmons
  • 33
  • 2
3
votes
0 answers

How to handle very long requests in Rails with HTTParty?

I am using HTTParty gem for a Rails application (I call it Main) to send requests to a Rails API (I call it API). One of the request can be very long, it can last 10 seconds up to 6 minutes. Today I am using timeout: 600 option which helps to go…
Benjamin Bouchet
  • 12,971
  • 2
  • 41
  • 73
3
votes
0 answers

"End of file reached" error OR Zlib::BufError using HTTParty

I am experiencing two different errors - depending on whether I use Httparty in my Ruby app or I use it from the command line. URL I am trying to access:…
yas4891
  • 4,774
  • 3
  • 34
  • 55
3
votes
1 answer

How can I use a oauth2 token to create a connection with HTTParty

I am trying to connect to the Basecamp API using HTTParty, I am however getting an issue with authentication. I am getting an error "HTTP Basic: Access denied", which doesn't make sense when I am trying to do OAuth. The class looks a bit like this…
Dofs
  • 17,737
  • 28
  • 75
  • 123
3
votes
1 answer

Spotify Web API Bad Request Error "invalid_client" when refreshing token

I'm building an app in Rails using the Spotify web API. I built a method to refresh a user's token, but am receiving a 400 error. According the the Spotify Web API docs, the header of my request needs to be in the following format: Authorization:…
patkil
  • 1,929
  • 3
  • 16
  • 17
3
votes
1 answer

How to pass patch http request parameters via HTTParty gem?

I am using the HTTParty gem to make a patch request to update an object via an API call as follows: params = { first_name: "John"} @options = {params: params} @response = HTTParty.patch("http://localhost:3000/1/kites/4", @options) But on the API…
Nona
  • 5,302
  • 7
  • 41
  • 79
3
votes
1 answer

Why does this Unicode / UTF-8 "En Dash" character in my JSON feed get mangled when I download it?

My JSON feed is here: http://america.aljazeera.com/bin/ajam/api/story.json?path=/content/ajam/watch/shows/america-tonight/articles/2014/4/28/the-dark-side-oftheoilboomhumantraffickingintheheartland It is a JSON representation of this HTML page, you…
Gal
  • 5,537
  • 1
  • 22
  • 20
3
votes
2 answers

Trying to connect to a "digest authentication" webservice using HTTParty or Net:HTTP (or etc)

I have been trying to connect to a web service that is using digest authentication. I am able to connect in Safari using user:password@service.site.com/endpoint I have tried in Ruby and Rails to connect using HTTParty and Net:HTTP using the…
3
votes
2 answers

Api Requests with Ruby gem Typhoeus

What is wrong with the following request? request = Typhoeus::Request.new("http://fluidsurveys.com/api/v2/groups", method: :get, userpwd: "test_user:test_password", …
Luigi
  • 5,443
  • 15
  • 54
  • 108
3
votes
1 answer

How to control HTTParty output using a rails logger

http://www.ruby-doc.org/gems/docs/b/bartzon-httparty-0.6.1/HTTParty/ClassMethods.html#method-i-debug_output How should I control the HTTParty output using a rails logger? I don't want to see this on the staging or prod environment. class…
Rpj
  • 5,348
  • 16
  • 62
  • 122
3
votes
1 answer

Ruby on Rails: Foursquare remove list item gives 400 value is invalid for item id

I'm trying to remove a specific item from a FourSquare list, I was originally using the Foursquare2 gem but have been debugging with HTTParty. I'm doing the following…
3
votes
1 answer

Strange Timeout::Error with render_to_string and HTTParty in Controller Action

Within my controller action i am using render_to_string with a jbuilder template to render an object for a http post action to an API, the results of this API-Call is what should be rendered by the controller. But i get a strange timeout then i call…
jethroo
  • 2,086
  • 2
  • 18
  • 30