faraday

URL encoding issues with curly braces

旧城冷巷雨未停 提交于 2019-12-23 04:33:41
问题 I'm having issues getting data from GitHub Archive. The main issue is my problem with encoding {} and .. in my URL. Maybe I am misreading the Github API or not understanding encoding correctly. require 'open-uri' require 'faraday' conn = Faraday.new(:url => 'http://data.githubarchive.org/') do |faraday| faraday.request :url_encoded # form-encode POST params faraday.response :logger # log requests to STDOUT faraday.adapter Faraday.default_adapter # make requests with Net::HTTP end #query =

Faraday conflicts in google_drive and google-api-client

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 12:58:15
问题 I'd like to be able to use both the google-api-client gem to do service to service authentication and the google_drive api to access spreadsheets. Unfortunately, these gems seem to conflict due to requiring different versions of Faraday in their dependencies. Anyone know how to solve this? Error if google_drive is required first: specification.rb:1637:in `raise_if_conflicts': Unable to activate google-api-client-0.4.4, because faraday-0.8.1 conflicts with faraday (~> 0.7.0) (Gem::LoadError)

How do I debug HTTP of Ruby google-api-client

谁都会走 提交于 2019-12-18 08:57:27
问题 I'm trying to integrate with Google Drive, using the google-api-client. Since there's a lot of stuff going on, I would like to be able to see what's going over the wire (http level). It seems that the client uses Faraday for http connectivity. How would I get a wiredump out of Faraday for debugging? 回答1: Google api client uses Faraday.default_connection by default. It is thus possible to manipulate this object, which can be done simply with the following line of code: Faraday.default

Stubbing with Faraday and Rspec

僤鯓⒐⒋嵵緔 提交于 2019-12-12 07:31:56
问题 I have a model that looks like this: class Gist def self.create(options) post_response = Faraday.post do |request| request.url 'https://api.github.com/gists' request.headers['Authorization'] = "Basic " + Base64.encode64("#{GITHUB_USERNAME}:#{GITHUB_PASSWORD}") request.body = options.to_json end end end and a test that looks like this: require 'spec_helper' describe Gist do context '.create' do it 'POSTs a new Gist to the user\'s account' do Faraday.should_receive(:post) Gist.create({:public =

How to change OPENSSLDIR on Ubuntu?

霸气de小男生 提交于 2019-12-11 13:59:25
问题 I'm trying to do some configuration so that I can use SSL/HTTPS with the Faraday gem in my Ruby on Rails app. I'm following the directions on the Faraday official site, but I'm stuck on a step. I don't know how to change the value of OPENSSLDIR (see image below). I've looked all over for a command to do this. Any help would be appreciated! My OS is Ubuntu. 回答1: How to change OPENSSLDIR on Ubuntu? There are two ways. One way works with all versions of OpenSSL, the second works with OpenSSL 1.0

GitHub OAuth authorize request doesn't redirect to Authorize Application page

雨燕双飞 提交于 2019-12-11 09:30:15
问题 I've implemented my own classes for handling authorization via OAuth to GitHub using Faraday in Ruby. I've verified that under the following conditions: Not logged into GitHub No token exists for the app that a request for authorization via GET to "/login/oauth/authorize" with a random state variable: Redirects to the GitHub login page Redirects to the Authorize Application page after login Executes callback to my app with temporary code after authorizing Responds with access_token when I

Omniauth + Google + Faraday + Behind the proxy = how setup proxy?

夙愿已清 提交于 2019-12-10 11:21:33
问题 My production server is Ubuntu 12 . I'm using Devise + OmniAuth to handle the Google authentication. But when Google returns a control to my application I get an error "Network is unreachable" . I assume it's because of server is behind the proxy. Here's error description: ------------------------------- Request: ------------------------------- * URL : http://efiling.uipv.org/users/auth/google_oauth2/callback?state=f4eaca9fbed2a77c0baac50cdbdccab7eee671179bb8fc43&code=4

How disable http logs from Rspec output?

杀马特。学长 韩版系。学妹 提交于 2019-12-08 18:36:08
问题 I'm writing tests for my rails application. I want to see only '.' and '*' symbols, when rspec running. But I'm watching HTTP logs and don't know how disable them. Piece of rspec output from my terminal: .............get http://0.0.0.0:3000/device_info/?api_session=%23%7Bapi_session%7D User-Agent: "Faraday v0.8.7" 404 content-type: "text/html" x-cascade: "pass" connection: "close" server: "thin 1.5.1 codename Straight Razor" .....get http://0.0.0.0:3000/device_info/12345?api_session=%23%7Bapi

Faraday conflicts in google_drive and google-api-client

二次信任 提交于 2019-12-06 07:22:50
I'd like to be able to use both the google-api-client gem to do service to service authentication and the google_drive api to access spreadsheets. Unfortunately, these gems seem to conflict due to requiring different versions of Faraday in their dependencies. Anyone know how to solve this? Error if google_drive is required first: specification.rb:1637:in `raise_if_conflicts': Unable to activate google-api-client-0.4.4, because faraday-0.8.1 conflicts with faraday (~> 0.7.0) (Gem::LoadError) Error if google/api_client comes first: specification.rb:1637:in `raise_if_conflicts': Unable to

How to send JSON form data with Mechanize or Faraday in Ruby

拈花ヽ惹草 提交于 2019-12-06 07:04:51
问题 I want to retrieve data from a website that uses JSON data to set custom search parameters which seem to be requested via AJAX. The data transmitted shows up under XHR->Request Payload in Firebug: {"filters": [{"action": "post", "filterName": "Hersteller", "ids": [269], "settingName": "Hersteller", "settingValue": "ValueA"}, {"action": "delete", "filterName": "Modelle", "settingName": "Modelle", "settingValue": ""}]} The site doesn't transmit any POST parameters but only this JSON encoded