Coder Social home page Coder Social logo

ruby-sdk's Introduction

WePay SDK for Ruby

Source Latest Stable Version Total Downloads Open Issues Build Status Coverage Status Code Climate Code Quality Author Author

Check out our developer docs at https://stage.wepay.com/developer for more information, or you may email [email protected] if you have any other questions.

This project uses Semantic Versioning for managing backwards-compatibility.

NOTE: Version 0.4.0 is not strictly backwards-compatible with the earlier 0.0.x versions.

NOTE: Due to impending PCI 3.x changes, we will be disabling support for TLS < 1.2 over our API. TLS 1.2 support requires Ruby 2.0.0. As such, while this SDK may function with Ruby 1.9, we no longer support it.

Installation

gem 'wepay', '~> 0.4.0'

And include it in your scripts:

require 'wepay'

Examples

client_id = 'your_client_id'
client_secret = 'your_client_secret'
use_stage = true

wepay = WePay::Client.new(client_id, client_secret, use_stage)

# Get the OAuth 2.0 authorization URL. Send the user to this URL to authorize
# the application, then they will return to your `redirect_uri` with a code as
# a GET parameter.
redirect_uri = "http://myexamplesite.com/wepay"
redirect_to(wepay.oauth2_authorize_url(redirect_uri))

# Once you have the OAuth 2.0 code, you can request an access token.
response = wepay.oauth2_token(code, redirect_uri)
access_token = response['access_token']

# Make a call to the `/user` endpoint (which requires no parameters).
response = wepay.call('/user', access_token)

# You may also open a payment account for the user.
response = wepay.call('/account/create', access_token, {
  :name        => "test account",
  :description => "this is only a test"
})

Testing

Firstly, run bundle install to download and install the dependencies.

You can run the tests as follows:

make test

API Reference

The API Reference is generated by a tool called YARD. Once it's installed, you can generate updated documentation by running the following command in the root of the repository.

make docs

Contributing

Here's the process for contributing:

  1. Fork Signer to your GitHub account.
  2. Clone your GitHub copy of the repository into your local workspace.
  3. Write code, fix bugs, and add tests with 100% code coverage.
  4. Commit your changes to your local workspace and push them up to your GitHub copy.
  5. You submit a GitHub pull request with a description of what the change is.
  6. The contribution is reviewed. Maybe there will be some banter back-and-forth in the comments.
  7. If all goes well, your pull request will be accepted and your changes are merged in.

Authors, Copyright & Licensing

  • Copyright (c) 2012โ€“2017 WePay

See also the list of contributors who participated in this project.

Licensed for use under the terms of the Apache 2.0 license.

ruby-sdk's People

Contributors

biplap-sarkar avatar camerona93 avatar feifanzhou avatar freakinfacu avatar iain-davis avatar leblanc avatar naissa12 avatar ryanmojo avatar skyzyx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby-sdk's Issues

Update RubyGems

'gem unpack wepay' still shows the code which is old and does not contain the recent fixes.
Please update wepay RubyGems with the updated code

Undefined method '+@' thrown in oauth2_authorize_url

Hello,

I just wanted to let you know of an error I was receiving when calling the oauth2_authorize_url method that is part of the Client class. This might be due to having certain versions of certain files, but if I made the following changes:

screenshot of changes

Things seemed to go back to normal for this call. I got the idea from this page:

plusatgooglesearch

and the reason I'm giving you a screenshot instead of a link to that page is because I think the site is actually down now, but google let me view a cached copy of the page that didn't have any styling and some characters missing. Here is THAT link. Hope this helps. Thanks for the gem.

Add authorization header correctly

Currently authorization header is added using
call.add_field('Authorization: Bearer', access_token);

This gives error sometimes with message suggesting authorization header should be of type Bearer when the header is not added correctly to the HTTP request

Using header name as 'Authorization' and passing the value 'Bearer <access_token>' works for me as following:-
call.add_field('Authorization', "Bearer #{access_token}");

Could you add some good tests for this SDK?

Hi Guys,

Right now wepay-rails uses HTTParty for communications with the wepay api. I'd like to change that and use your SDK instead. We are starting a major testing effort on the wepay-rails gem and I was hoping that you guys could write some around your SDK that can call your service in a real way vs. stubbing out some responses. This would help us to ensure that our code is good as well.

Thanks in advance,

Adam (wepay-rails)

Logging to $stdout

Is there any way to configure and not log to $stdout? or thoughts? I don't like running rspec tests and seeing the net http calls.

I thought of $stdout.stub(:write) for my tests but it wouldn't work well with pry :)

Thanks!

Cancel subscription call returns JSON error?

Hi,

Using rails 4.1.0, wepay 0.0.3

ONLY when I call a cancel subscription call, i am getting this error:

JSON::ParserError:
A JSON text must at least contain two octets!

When i do a raise on the response.body object (raise response.body.inspect) I get this:

"{"subscription_plan_id":1425787008}"

The JSON looks ok. Also, when I do:

JSON.parse("{"subscription_plan_id":1425787008}")

It parses just fine? I am totally stumped as to why I'm getting this error. Anyone else having this problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.