Project

tinysou

0.0
No commit activity in last 3 years
No release in over 3 years
Tinysou Ruby client
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
>= 0
>= 3.0

Runtime

 Project Readme

Tinysou

Build Status

Ruby library for the Tinysou API.

Installation

Add this line to your application's Gemfile:

gem 'tinysou'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tinysou

Usage

client = Tinysou::Client.new 'YOUR_TOKEN'

Engine

List:

client.engines

Create:

client.create_engine name: 'blog', display_name: 'Blog'

Read:

client.engine 'blog'

Update:

client.update_engine 'blog', display_name: 'My Blog'

Delete:

client.destroy_engine 'blog'

Collection

List:

client.collections 'blog'

Create:

client.create_collection 'blog', name: 'posts', field_types: {
  title: 'string',
  tags: 'string',
  author: 'enum',
  date: 'date',
  body: 'text'
}

Read:

client.collection 'blog', 'posts'

Destroy:

client.destroy_collection 'blog', 'posts'

Document

List:

client.documents 'blog', 'posts', page: 0, per_page: 20

Create:

client.create_document 'blog', 'posts', {
  title: 'My First Post',
  tags: ['news'],
  author: 'Author',
  date: '2014-08-16T00:00:00Z',
  body: 'Tinysou start online today!'
}

Read:

client.document 'blog', 'posts', '293ddf9205df9b36ba5761d61ca59a29'

Update:

client.update_document 'blog', 'posts', '293ddf9205df9b36ba5761d61ca59a29', {
  title: 'First Post'
}

Delete:

client.destroy_document 'blog', 'posts', '293ddf9205df9b36ba5761d61ca59a29'

Search

client.search 'blog', {
    q: 'tinysou', c: 'posts',
    page: 0, per_parge: 10,
    filter: {
        range: {
            field: "date",
            from: "2014-07-01T00:00:00Z",
            to: "2014-08-01T00:00:00Z"
        }
    },
    sort: {
        field: "date",
        order: "asc",
        mode: "avg"
    }
}

Autocomplete

client.autocomplete 'blog', q: 't', c: 'posts'

Examples

See examples

Contributing

  1. Fork it ( https://github.com/tinysou/tinysou-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