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

HttpParty::Response and try(:parsed_response) weird behavior

I've tried to use ActiveSupport's (2.3-stable) try() on an instance of HttpParty::Response. I've got a pretty strange behavior: > ro.parsed_response {"error"=>"RecordInvalid", "description"=>"Record validation errors", "details"=>{"email"=> …
FullOfCaffeine
  • 539
  • 1
  • 6
  • 22
3
votes
1 answer

What does HTTParty::get return?

I'm still new to Ruby and trying to use the HTTParty gem to help me write an API Wrapper. I feed HTTParty::get a URI and it parses JSON data. From a quick glance and the way the returned result behaves, it looks like a Hash, but is it? I can't seem…
DillPixel
  • 955
  • 1
  • 14
  • 20
3
votes
2 answers

Heroku, Nokogiri & Sidekiq memory leak - how to debug?

I just switched to using Sidekiq on Heroku but I'm getting the following after my jobs run for a while: 2012-12-11T09:53:07+00:00 heroku[worker.1]: Process running mem=1037M(202.6%) 2012-12-11T09:53:07+00:00 heroku[worker.1]: Error R14 (Memory quota…
mind.blank
  • 4,820
  • 3
  • 22
  • 49
2
votes
2 answers

Extracting values from a hash

Hello Im using HTTParty to call for a remote json file that I need to extract the URL's to use in one of my tests.. the json format goes something like: "manifest" : { "header" : { "generated" : "xxxxxxxxxxxxxxx", "name" :…
cfernandezlinux
  • 861
  • 1
  • 10
  • 23
2
votes
1 answer

ActiveResource vs HTTParty

I'm moving our primary datastore away from ActiveRecord, and instead the data will be accessible through a REST api as JSON. Should I use ActiveResource or HTTParty to access the data? It's primarily going to be read-only for view rendering.
MrEvil
  • 7,785
  • 7
  • 36
  • 36
2
votes
1 answer

Specific Ruby on Rails routes deliema

Currently developing a RoR mobile web application for displaying information about particular places. Let's call these places 'installations'. Each installation has at least one 'venue', which is a specific instance of the installation. So for…
Gowiem
  • 1,297
  • 17
  • 19
2
votes
1 answer

Create record example for Quickbooks Online and Intuit Anywhere using Ruby and httparty?

Can someone post an example of creating a record in quickbooks online / intuit anywhere, using ruby and httparty? I am working on an integration to a ruby on rails app using intuit anywhere, and am running into an issue with my POST request when…
2
votes
2 answers

POSTing large amounts of data with HTTParty

I'm using HTTParty to post information to a server using the following code: this_component = {"name" => "something", "ip" => "localhost", "logs" => logs_to_push} payload = {"payload" => JSON.dump(this_component)} response =…
Chris Bunch
  • 87,773
  • 37
  • 126
  • 127
2
votes
2 answers

How to keep Ruby object instance variables hidden from view in irb or logs?

I am making a gem to wrap an API. The service requires a few login parameters so I made a Connection class to initialize by passing in all login values, and storing with instance variables. One of these values, @secret_access_key is secret,…
Erik J
  • 828
  • 9
  • 22
2
votes
1 answer

Using HTTParty to post json to Google Places

I'm trying to figure out how to write a google places POST request using HTTParty. I was able to do a GET request but can't figure out how to work around the fact that Google Places has a nested parameter to post into. Here is the json syntax from…
Ray A.
  • 161
  • 1
  • 1
  • 9
2
votes
1 answer

Use api key in HTTParty

I am trying to access a service which uses the url format. www.example.com/api/API_KEY/action The below code is a small example of what I'm trying to achieve. require 'httparty' class MyAPI include HTTParty debug_output $stdout base_uri…
Pete Hamilton
  • 7,730
  • 6
  • 33
  • 58
2
votes
1 answer

Request returns 401 Unauthorized with headers using HTTParty

i can get response from API using curl like this: curl -X GET https://myapi.com/... -H "client_id: my_id" -H "client_secret: my_secret" but when i send requests with HTTParty: response = HTTParty.get(url, headers: {"client_id" => "my_id",…
2
votes
1 answer

Getting "undefined method `css' for nil:NilClass (NoMethodError)" with using HTTPparty & Nokogiri

I'm not sure what I'm doing wrong. I'm new to coding so it could be something very simple. I've looked around and can't find a solution. It's in the first line in self.scrape_mainpage function. require 'HTTParty' require 'Nokogiri' require…
PenoG
  • 35
  • 6
2
votes
1 answer

Upload a file from ActiveStorage to an API

I'm trying to upload a file to an API with Httparty gem. Here is the requested format, from the documentation of this API: Method: POST Content-Type: application/json { "name": "filename.png", "type": 2, "buffer": "iVBOR..." } My document…
Shrolox
  • 663
  • 6
  • 22
2
votes
2 answers

Limiting the number of threads to be executed

I am trying to limit the number of threads that must be executed simultaneously or to separate the elements of the array in a certain amount and send them separately (splice) but I have no idea where and how to start. The code is executing the…