GithubHelp home page GithubHelp logo

sqwiggle-ruby's Introduction

Ruby Client for the Sqwiggle API

Build Status

A Ruby wrapper for the Sqwiggle REST API.

Installation

Add this line to your application's Gemfile:

gem 'sqwiggle-ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sqwiggle-ruby

Configuration

Create an API Client at https://www.sqwiggle.com/company/clients

Once you have a token there are two ways of instantiating an instance of a client.

Globally (not thread safe)

Sqwiggle.token = 'your token here'
client = Sqwiggle.client

Locally (thread safe)

client = Sqwiggle.client('your token here')

Which is basically syntactic sugar for

Sqwiggle::Api::Client.new('your token here')

Usage

Services

A service acts a bit like an ActiveRecord relation proxy

#load the message service
messages = client.messages

#the service currently has the following methods
old_message = messages.find 42
new_message = messages.new(params)
all_messages = messages.all

Available Services

  • messages
  • invites
  • conversations
  • attachments
  • organizations
  • rooms
  • users

Resources

Resources are not dissimilar to an ActiveResource or an ActiveRecord object

#with a persisted object
message = client.messages.find 42
message.update(text:'the message') #fails silently
message.update!(text:'the message') #raises a Sqwiggle::Api::Errors::BadRequestError

#creating a new object
message = client.messages.new
message.text = 'the new message'
message.save #fails silently
message.save! #raises an error

TODO

  • Capistrano integration
  • Pagination
  • Rdoc (or similar)

Contributing

  1. Fork it
  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 new Pull Request

sqwiggle-ruby's People

Contributors

awsmsrc avatar tommoor avatar

Watchers

James Cloos 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.