maxio-com / chargify2 Goto Github PK
View Code? Open in Web Editor NEWChargify API V2 Ruby Wrapper
License: MIT License
Chargify API V2 Ruby Wrapper
License: MIT License
Should we retire ree
and 1.8.7
from travis testing?
I have the following in my haml Rails view:
= chargify.direct.secure_parameters(data: {redirect_uri: 'http://requestb.in/14d7g2l1'}).to_form_inputs.html_safe
I have verified my api keys and the hidden input fields. I receive a message saying incorrect signature, which makes sense because when I copy and paste my secure data and api key directly from the hidden input values, into https://chargify-direct-signature.herokuapp.com, I get a different signature.
How do I make this gem generate the proper signature? Is this gem outdated?
Any time you require 'chargify2'
in a rails environment with config.cache_classes = true
, the chargify2 gem will throw the following error:
/var/www/apps/sample_app/shared/bundle/ruby/1.9.1/gems/chargify2-0.2.0/lib/chargify2/resource.rb:10:in `<class:Resource>': uninitialized constant Chargify2::Client (NameError)
from /var/www/apps/sample_app/shared/bundle/ruby/1.9.1/gems/chargify2-0.2.0/lib/chargify2/resource.rb:7:in `<module:Chargify2>'
from /var/www/apps/sample_app/shared/bundle/ruby/1.9.1/gems/chargify2-0.2.0/lib/chargify2/resource.rb:1:in `<top (required)>'
from /var/www/apps/sample_app/shared/bundle/ruby/1.9.1/gems/chargify2-0.2.0/lib/chargify2.rb:6:in `block in <top (required)>'
from /var/www/apps/sample_app/shared/bundle/ruby/1.9.1/gems/chargify2-0.2.0/lib/chargify2.rb:6:in `each'
from /var/www/apps/sample_app/shared/bundle/ruby/1.9.1/gems/chargify2-0.2.0/lib/chargify2.rb:6:in `<top (required)>'
In the chargify2.rb file, the following line is requiring each of the files in the gem:
If the load order for these files is wrong, it will throw the "uninitialized constant Chargify2::Client" error from the following line:
I'll try to get a failing test going, and probably will list out an explicit load order in chargify2.rb like:
require 'chargify2/utils'
require 'chargify2/client'
require 'chargify2/resource'
This should prevent load order problems when the gem is required.
Users can retrieve their own credentials through the settings section for an individual site.
This should probably be updated, the current README led me to wait hours for on a support ticket needlessly.
Thanks!
It returns false all the time.
c.successful? #=> false
c.response['result']['status_code'] #=> '200'
Why not use c.success
attribute instead ?
Can we see an update to the Hashery version you are using here? It's breaking my RestClient library.
For some reason, all the versions since 0.2.1 are all listed as having been released on October 28, 2011. http://rubygems.org/gems/chargify2/versions
Hi,
Simple example:
chargify2 = Chargify2::Client.new(:api_id => ENV['CHARGIFY_DIRECT_API_ID'], :api_secret => ENV['CHARGIFY_DIRECT_API_SECRET'], :api_password => ENV['CHARGIFY_DIRECT_PASSWORD'], :base_uri => "https://api.chargify.com/api/v2/")
call = chargify2.calls.read('xxxxxxx')
call.request.signup
=> {}
call.request['signup']
=> {"product"=>{"handle"=>"pro"}, "coupon_code"=>"", "customer"=>{"first_name"=>"Zain", "last_name"=>"Zafar", "email"=>"******@gmail.com"}, "payment_profile"=>{"first_name"=>"", "last_name"=>"", "card_number"=>nil, "expiration_month"=>"", "expiration_year"=>""}}
This doesn't stop here, all the hash keys aren't symbolized either. Need to manually use .symbolize_keys for it to work.
In case of 404
status_code
is not getting set in response. Im are using api_v2
branch.
chargify = Chargify2::Client.new(api_id: <masked>, api_password: <masked>, base_uri: 'https://api.chargify.com/api/v2')
chargify.customers.read(1)
<Chargify2::Response:0x007f8c1d878ec0 @resource=#<Chargify2::Customer>, @meta=#<Hashie::Mash errors=[#<Hashie::Mash attribute=nil kind="not_found" message="The requested Customer could not be found.">]>, @status_code=nil, @errors=[#<Hashie::Mash attribute=nil kind="not_found" message="The requested Customer could not be found.">]>
When I tried to hit the api directly, i could see status_code being sent in the chargify api response. So guessing the issue to be in the gem.
curl -v -u <api_id>:x -H Accept:application/json -H Content-Type:application/json https://mavenhive-ghuk.chargify.com/customers/1
* Hostname was NOT found in DNS cache
* Trying 54.244.7.151...
* Connected to mavenhive-ghuk.chargify.com (54.244.7.151) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
* Server certificate: *.chargify.com
* Server certificate: COMODO RSA Organization Validation Secure Server CA
* Server certificate: COMODO RSA Certification Authority
* Server certificate: AddTrust External CA Root
* Server auth using Basic with user 'dvLih3EFHkpluaBrGP7A'
> GET /customers/1 HTTP/1.1
> Authorization: Basic ZHZMaWgzRUZIa3BsdWFCckdQN0E6eA==
> User-Agent: curl/7.37.1
> Host: mavenhive-ghuk.chargify.com
> Accept:application/json
> Content-Type:application/json
>
< HTTP/1.1 404 Not Found
< Cache-Control: no-cache, private
< Content-Type: application/json; charset=utf-8
< Date: Wed, 04 Mar 2015 11:27:09 GMT
< P3p: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
* Server nginx + Phusion Passenger is not blacklisted
< Server: nginx + Phusion Passenger
< Set-Cookie: _chargify_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFVEkiJTRlMjNlMGVjZGYzOWRkZDAyYmVlZDViOGJmNGM2MzhjBjsAVEkiF3NlbGxlcl9jcmVkZW50aWFscwY7AEZJIgGAZTJlYjBjOTViOWRkZWY2NWYwYTNlZDk4NDYwYmNjN2FlYzFmNzJmNjgxNWRmOWYyMTI4MGJjODgzMmY2NzIyNTczMzlhMjA2NzI5YjU4Y2RiM2RlOWY3YjJhN2YwZTIwMDQ2NzE5YmY0YTM5M2IxYjVlMmY0MzY4MTE0YjU2YzAGOwBGSSIac2VsbGVyX2NyZWRlbnRpYWxzX2lkBjsARmkCsjw%3D--b0cc8c93ff92f3de8d3abf63671acb887fa8b82b; domain=.chargify.com; path=/; secure; HttpOnly
< Status: 404 Not Found
< X-Frame-Options: SAMEORIGIN
< X-Powered-By: Phusion Passenger
< X-Rack-Cache: miss
< X-Ratelimit-Limit: 1000000
< X-Ratelimit-Remaining: 999982
< X-Ratelimit-Reset: 1425513600
< X-Request-Id: f2ab412e-9ab7-464a-88df-695e555b852a
< X-Runtime: 0.029060
< X-Ua-Compatible: IE=Edge,chrome=1
< Content-Length: 1
< Connection: keep-alive
<
* Connection #0 to host mavenhive-ghuk.chargify.com left intact
I'm working on a new app using the direct API and all of the response methods are blank. I was able to trace it back to the method call on recursive_symbolize_keys
which does not seem to exist.
There's no error shown for this because we're using the magic method_missing crap, so this was a huge pain in the butt to trace.
Without this, it means that chargify/chargify_direct_example is also broken. Please correct me if I'm wrong.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.