GithubHelp home page GithubHelp logo

paymill-ruby's Introduction

PAYMILL icon

paymill-ruby

Ruby wrapper for PAYMILL API forked by dkd's paymill-ruby

Build Status Code Climate

Getting started

  • If you are not familiar with PAYMILL, start with the documentation.
  • Install the latest release.
  • Check the API reference.
  • Check the specification examples.
  • Take a look at the change log for recent updates and improvements.

Installation

Add this line to your application's Gemfile:

gem 'paymill', git: 'git://github.com/paymill/paymill-ruby.git'

And then execute:

$ bundle

The paymill gem is tested on Ruby 1.9.3, 2.0.0, 2.1.0, 2.1.3 and 2.1.5. It requires ruby version 1.9.3+

Usage

Initialize the library by providing your api key:

Paymill.api_key = '<YOUR PRIVATE API KEY>'

or by reading it from the envirounment variables

Paymill.api_key = ENV['PAYMILL_API_TEST_KEY']

Clients

Creating clients

Creating via factory method create, which expects an optional hash as arguments. If some of the required attributes are missing the method will throw ArgumentError.

  • with a hash of optional arguments:
client = Paymill::Client.create( email: '[email protected]', description: 'Main caracter in First Blood' )
  • without arguments:
client = Paymill::Client.create

Find/refresh existing client

You can retrieve an object by using the find method with an object id:

client = Paymill::Client.find( 'client_b54ff8b3811e06c02e14' )

or with the instance itself, which also refreshes it:

client = Paymill::Client.find( client )

Update client

Update is done by modifying the instance variables of the object. The object itself provides accessor methods only for properties which can be updated.

client = Paymill::Client.find( 'client_b54ff8b3811e06c02e14' )

client.email = '[email protected]'
client.description = 'Main caracter in First Blood II'

client = Paymill::Client.update( client )

Deleting client

You may delete objects by calling the class delete method with an object instance or object id.

Paymill::Client.delete( client )
Paymill::Client.delete( 'client_b54ff8b3811e06c02e14' )

Retrieving lists

To retrieve a list you may simply use the all class method

clients = Paymill::Client.all

You may provide filter, order, offset and count parameters to list method

clients = Paymill::Client.all( order: [:email, :created_at_desc], count: 30, offset: 10, filters: [email: '[email protected]', created_at: "#{4.days.ago.to_i}-#{2.days.ago.to_i}"] )

Contributing

  1. Fork it ( https://github.com/paymill/paymill-ruby/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

paymill-ruby's People

Contributors

flippingbits avatar zamith avatar traxmaxx avatar nikoloff avatar acwebionate avatar defsprite avatar andreaslyngstad avatar theodorton avatar abarre avatar dongennl avatar jacegu avatar lluis avatar nerian avatar molpe avatar ryanharkins avatar

Stargazers

Stefan Maier avatar

Watchers

James Cloos avatar

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.