Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Faraday instead of Patron #88

Closed
wants to merge 17 commits into from

Conversation

chytreg
Copy link
Contributor

@chytreg chytreg commented Apr 28, 2013

Hi,

I did quite big rewrite of client.rb to use Faraday library.
This give us all benefits of Faraday gem https://github.com/lostisland/faraday
The client.rb is much cleaner retry and json parsing are as the middleware.
I change default json pare to yail-ruby because is much quicker and has seamless integration flow.

We can use for example typhoeus adapater:

require 'parse-ruby-client'
require 'typhoeus'
require 'typhoeus/adapters/faraday'

Faraday.default_adapter = :typhoeus
Parse.init {:application_id => "<your_app_id>", :api_key => "<your_api_key>"} do |faraday|
  # here you can pass some additionals to faraday directly
end

@adelevie
Copy link
Owner

This looks really, really great. I'm just curious as to what the good use-cases for Faraday are? I'm probably going to merge this anyway, but I'm curious.

Also, would be interested to hear from @ericcj on this (and anyone else!).

@chytreg
Copy link
Contributor Author

chytreg commented Apr 29, 2013

Faraday is an abstract layer for http adapters, so you use the same interface, but easily change http adapter. Next is based on middlewares so you can move the processing of http requests form main part of you application, and gain much cleaner code. Imho the middleware support is the real power of Faraday.

query = foo_query.or(bar_query)
assert_equal 2, query.get.size
#end
foo = Parse::Object.new "Post"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was vcr disabled in this one intentionally? it seems like it would work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes because it did't work :/ I think it's because of "random query"
The same is for test_user.rb.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's easy to fix, foo["random"] = 'blah' and for the next one bar["random"] = 'meow' instead of using rand

@ericcj
Copy link
Contributor

ericcj commented Apr 29, 2013

thanks for this pull, it's definitely what i was looking for us to do with client.rb. ship it after my couple concerns

@ericcj
Copy link
Contributor

ericcj commented May 20, 2013

@chytreg would love to see this get merged. will you have a chance to look over those last couple remaining comments? thanks again

@adelevie
Copy link
Owner

adelevie commented Jun 5, 2013

So what are the main issues here that need to be fixed?

@ericcj
Copy link
Contributor

ericcj commented Jun 5, 2013

mostly the retry logic, and also would be nice to keep the logging on retries

@chytreg
Copy link
Contributor Author

chytreg commented Jun 5, 2013

I'm quite busy, but will try to look in to it asap.

Pozdrawiam
Dariusz Gertych
+48 603 586 621

2013/6/5 Eric Jensen notifications@github.com

mostly the retry logic, and also would be nice to keep the logging on
retries


Reply to this email directly or view it on GitHubhttps://github.com//pull/88#issuecomment-18978043
.

@ericcj
Copy link
Contributor

ericcj commented Jun 5, 2013

thanks! if you don't get to it we will eventually

@ericcj ericcj mentioned this pull request Sep 3, 2013
@cpjolicoeur
Copy link

👍

@kwent
Copy link
Contributor

kwent commented Mar 24, 2014

Should be nice to merge to master !

@bricker
Copy link

bricker commented May 10, 2014

👍 on this one, would love to see this merged in.

@kenn
Copy link
Contributor

kenn commented May 15, 2014

Just failed to deploy because patron failed to compile as we don't have curl installed on the server.

And installing libcurl4-openssl-dev has so many dependencies on Debian Wheezy:

comerr-dev krb5-multidev libcurl4-openssl-dev libgcrypt11-dev libgnutls-dev libgnutls-openssl27 libgnutlsxx27 libgpg-error-dev libgssrpc4 libidn11-dev libkadm5clnt-mit8 libkadm5srv-mit8 libkdb5-6 libkrb5-dev libldap2-dev libp11-kit-dev librtmp-dev libssh2-1-dev libtasn1-3-dev

👍 on this PR

@rhymes
Copy link
Contributor

rhymes commented Jun 3, 2015

Faraday is the library now used to issue HTTP calls. This should be closed.

@xavdid xavdid closed this Jun 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants