Coder Social home page Coder Social logo

crowdtilt-ruby's Introduction

Crowdtilt Ruby Library

Introduction

This is a very rudimentary shot at implementing the Crowdtilt API. Feel free to add support for missing ones.

While continued development happens on the Crowdtilt API, I opted to forego specs conforming to the API schema since determining when changes happened were easier if the HTTP call blew up. This should really be fixed in the future once the schema solidifies.

Usage

First start by configuring Crowdtilt:

Crowdtilt.configure do
  key "KEY"
  secret "SECRET"
  env "production" # not setting this will default to "development"
end

If you're using Rails:

Crowdtilt.configure do
  key "KEY"
  secret "SECRET"
  env Rails.env
end

You should be good to go. Example usage:

# Create a user
u = Crowdtilt::User.new(:name => 'Ian', :email => '[email protected]')
u.persisted? #=> false
u.save 
u.persisted? #=> true

# List all users
Crowdtilt::User.all
#=> [Crowdtilt::User,...]

c = u.campaigns.create "title"            => "Foo",
                       "description"      => "Bar",
                       "expiration_date"  => 2.weeks.from_now,
                       "tilt_amount"      => 1000

Issues

Bound to be some issues since there's barely any specs. Feel free to submit an issue.

Endpoints Supported

  • [✓] POST /users
  • [✓] POST /users/:id/verification
  • GET /users/authentication?email=x&password=y
  • [✓] GET /users/:id
  • [✓] GET /users
  • [✓] PUT /users/:id
  • [✓] GET /users/:id/campaigns
  • [✓] GET /users/:id/campaigns/:id
  • GET /users/:id/paid_campaigns
  • [✓] POST /users/:id/cards
  • [✓] GET /users/:id/cards/:id
  • [✓] GET /users/:id/cards
  • [✓] PUT /users/:id/cards/:id
  • [✓] DELETE /users/:id/cards/:id
  • [✓] POST /users/:id/banks
  • [✓] GET /users/:id/banks/:id
  • [✓] GET /users/:id/banks
  • [✓] PUT /users/:id/banks/:id
  • [✓] DELETE /users/:id/banks/:id
  • [✓] GET /users/:id/payments
  • [✓] POST /campaigns
  • [✓] GET /campaigns/:id
  • [✓] GET /campaigns
  • [✓] PUT /campaigns/:id
  • [✓] POST /campaigns/:id/payments
  • [✓] GET /campaigns/:id/payments/:id
  • [✓] PUT /campaigns/:id/payments/:id
  • [✓] GET /campaigns/:id/payments
  • GET /campaigns/:id/rejected_payments
  • POST /campaigns/:id/payments/:id/refund
  • GET /campaigns/:id/settlements
  • GET /campaigns/:id/settlements/:id
  • POST /campaigns/:id/settlements/:id/bank
  • POST /campaigns/:id/comments
  • GET /campaigns/:id/comments
  • GET /campaigns/:id/comments/:id
  • PUT /campaigns/:id/comments/:id
  • DELETE /campaigns/:id/comments/:id

Todo

  • The association-like chaining executes the all http call before doing the find, or other method calls. Lazy eval the associated array so we don't do 2 calls.

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.