Giter Site home page Giter Site 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 rodzyn avatar willbarrett avatar

Stargazers

Paulo Marques avatar Angus H. avatar kimihito avatar Kengo Hamasaki avatar Zak B. Elep avatar Masaki Komagata avatar Robb Fitzsimmons avatar Pablo avatar Shu Uesugi avatar Karl Danninger avatar  avatar  avatar

Watchers

Kengo Hamasaki avatar  avatar Cameron Webb avatar Eric bieller avatar Karl Danninger avatar James Cloos avatar  avatar  avatar

sqwiggle-ruby's Issues

How to require / use this gem?

I'm not a ruby dev, just trying to hack an API call into an existing app, and I can't for the life of me figure out how.

Using the code in the 'local' example gives me an 'uninitialized constant' error.

I've tried adding require 'sqwiggle-ruby' and require 'sqwiggle'

I'm sure I'm missing something simple that all ruby devs would know, but I'm stuck! Thanks in advance for your help :)

P.S. sorry accidentally hit enter before I finished writing this

Stream ID not supported?

We've started getting Sqwiggle::Api::Errors::BadRequestError because we're not including a stream_id. But as far as I can tell, I can't provide a stream_id with the Ruby client. Am I missing something?

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.