rest-client

Using restclient with multipart posts

Hi all, I'm using restclient for a multipart form to send data to a restful web service (it's Panda video encoding service). The trick though, is that the file I am passing into restclient (Technoweenie branch) is coming from my own form that a user submits. So, lets walk through this. A user posts a file to my rails app. In my control...

Rails RestClient MultiPart Post

I have a spooling app that sits between a Ruby on Rails app, and a few Pandastream instances. Prior to the creation of the spooling application, the Rails app posted it's file data straight to Panda without issue. I've got the spooler receiving the file information and connection to the appropriate instance to pass the file data on, bu...

Changing gmail Settings with Ruby

I need to configure my gmail account(s) programmatically with Ruby. I checked out the apps api and it looks like the simplest possible solution would be to use ClientLogin for logging in and a simple XML PUT for changing the forwarding setting, for example. I wrote a little test script like so: http://gist.github.com/373457 It would a...

How do I use rest-client for ruby to post an image?

I am trying to find a way to use the Postful API and I need to post an image in the body of the request. I am trying to use rest-client (but am open to other ways): The error I get when I post is HTTP status code 422 Basically, I'm clueless and need guidance. :\ class PostfulsController < ApplicationController require 'rest_client...

getting internal server error using rest-client in ruby to post to HTTP POST

Hi, this is my code and I don't know how to debug it because I just get an "internal server error": I am trying to HTTP POST to an external ASPX: def upload uri = 'https://api.postalmethods.com/2009-02-26/PostalWS.asmx' #postalmethods URI #https://api.postalmethods.com/2009-02-26/PostalWS.asmx?op=UploadFile #http://www.p...

Can I use rest-client to POST a binary file to HTTP without multipart?

I have tried to do the following, but the web-service is NOT REST and does not take multi-part. What do I do in order to POST the image? @response = RestClient.post('http://www.postful.com/service/upload', {:upload => { :file => File.new("#{@postalcard.postalimage.path}",'rb') } ...

Send and Receive JSON using RestClient and Sinatra

Hi, I am trying to send a JSON data to a Sinatra app by RestClient ruby API. At client(client.rb) (using RestClient API) response = RestClient.post 'http://localhost:4567/solve', jdata, :content_type => :json, :accept => :json At server (Sinatra) require "rubygems" require "sinatra" post '/solve/:data' do jdata = params[:data...

Rest-Client Installation not working properly...

The following error is displayed in command prompt in Windows 7 C:\Users\rd\Desktop\Training\Problem2\sudoku\sudoku>gem install rest-client WARNING: RubyGems 1.2+ index not found for: http://gems.rubyforge.org/ RubyGems will revert to legacy indexes degrading performance. ERROR: could not find gem rest-client locally or in a ...

How do you upload a file with rest-client and specify the filename?

I tried the following to upload a file with RestClient, but the resulting POST always uses the file's filename ("testfile.txt") instead of "file_name.txt": RestClient::Resource.new(path, resource_options).post(:transfer => { :path => "file_name.txt" }, :upload => File.new('/tmp/testfile.txt', 'rb')) ...

RestClient for Ruby with smarkets.com api - Curl to RestClient

the api I'm working with is here: I'm able to log in fine and get back an auth token, but cant figure out how to do anything that requires a token. I get back a forbidden response when I try to get or post a private URL. they give an example of the request that needs to be sent using curl: curl \ --header 'Authorization: User...

C#: Proper way to copy HttpQueryString parameters?

A little background: I'm using the WCF REST Starter kit, and I'm creating a wrapper for a specific API I'm consuming. There are common query string parameters that I need to pass whenever I hit any of the exposed methods, such as an API key. To me, it would be easier to make such common parameters a part of the wrapper class. Then I cou...

mocking nested resources in rest-client with rspec

Hi there, I've been trying to mock a rest-client nested resource to test my class. Here's the test: require 'rest_client' require File.join(File.dirname(__FILE__), "/../src/job_resource.rb") describe JobResource, "#has_stagein" do before :each do response = mock(String).stub!(:code).and_return(200) job_resource = mock(Rest...

archiloque-rest-client: change content-type to multipart/related when posing a file

Using http://github.com/archiloque/rest-client When posting a file using this line, the content type is set as Content-Type: multipart/form-data; boundary=301405 in the header, by default. RestClient.post '/data', :myfile => File.new("/path/to/image.jpg", 'rb') I tried this and it still sets the header multipart/form-data. RestC...

File upload with rest-client.

Model .. def self.upload_client_document(params) client_document = self.new :uploaded_data => params[:Filedata],:client_id => params[:client_id],:document_name => self.default_document_name,:document_description => self.default_description_name client_document.rename_document_name client_document.save! # RAILS_ROOT + client_docu...