GithubHelp home page GithubHelp logo

pelokit's Introduction

Pelokit

Build Status

A gem for interacting with the Peloton API.

Gem Usage

In your Gemfile, point at this repo. In time, this will be added to RubyGems.

# Gemfile
gem 'pelokit', '~> 1.1.0', git: 'https://github.com/pelotontech/pelokit.git'

Setup

Configure the Pelokit module. In a Rails app, this is best done with a config/initializers file:

Pelokit.configure do |c|
  c.client_id    = 'your client id'
  c.account_name = 'your account name'
  c.password     = 'your password'
end

Endpoints

By default Pelokit will target Peloton's test environment. URLs for different environments can be injected with the same Rails initializer approach:

Pelokit.configure do |c|
  # ...
  c.wsdl = 'https://env-specific-wsdl... '
  c.rest = 'https://env-specific-rest... '
  # ...
end

BankAccount

BankAccount is a class for sending bank account coordinates to Peloton, and receiving back an identifier.

Default Credentials

Omit credentials, and Pelokit will use the underlying initializer credentials.

api_properties = {
  :bank_account_id             => "my id",
  :bank_account_name           => "foobar",
  :bank_account_owner          => "owner",
  :bank_account_type_code      => "1",
  :financial_insitution_number => "001",
  :branch_transit_number       => "23232",
  :account_number              => "121212",
  :currency_code               => "CAD",
  :verify_account_by_deposit   => "1"
}

peloton        = Pelokit::BankAccount.new api_properties

# ....
response = peloton.add

Deleting Accounts

account = Pelokit::BankAccount.new bank_account_id: '65238812f8cc4dbca1604c9cad96e5fa'
result  = account.remove
puts result.message

Validations

account = Pelokit::BankAccount.new bank_account_name: 'foo'
account.valid?
# false
puts account.errors.full_messages
# ["Financial insitution number can't be blank", "Financial insitution number must be numeric", "Branch transit number can't be blank", "Branch transit number must be numeric", "Account number can't be blank", "Account number must be numeric", "Bank account type code is not included in the list"]

pelokit's People

Contributors

dliggat avatar

Watchers

 avatar  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.