<commit_before># TaskRabbit Ruby Gem

Ruby wrapper for TaskRabbit API.

## Installation

    gem install taskrabbit

## Usage Example

### Configuration

In an initializer file.

    Taskrabbit.configure do |config|
      config.client_secret = 'your-client-secret'
    end

## Task

### use the API client

    tr = Taskrabbit::Api.new
    
or with a user token

    tr = Taskrabbit::Api.new(user_token)

### Get the list of all the tasks

    tr = Taskrabbit::Api.new
    # to get the /tasks
    tasks = tr.tasks.all
    # fetch the first task
    tasks.first
    
    tasks.all(:reload => true) # => will redo the query

### Find a task

    tr = Taskrabbit::Api.new
    t = tr.tasks.find(31231) # This actually wont do the request

To request the API:

    t.fetch # force fetching

or simply access a property:

    t.name # will do the query

### Find the tasks of an user

    tr.users.find(user_id).tasks

### Create a task

    tr = Taskrabbit::Api.new(user_token)
    task = tr.tasks.create({:named_price => 32, :name => 'Ikea'})

or 

    task = tr.tasks.new({:named_price => 32, :name => 'Ikea'})
    task.save

### Update a task

    task = tr.tasks.find('some-id')
    task.named_price = 45
    task.save

### Error for tasks creation or update

    tr = Taskrabbit::Api.new(client_secret)
    task = tr.tasks.new
    unless task.save
      task.error # => "Task title can't be blank, \nAmount you are willing to pay is not a number"
      task.errors # => { "messages" => ["Task title can't be blank", "Amount you are willing to pay is not a number"],
                         "fields" => [["name","can't be blank"], ["named_price","is not a number"]] }
    end

## User account

    tr = Taskrabbit::Api.new(client_secret)
    tr.account # => Taskrabbit::User object

    tr.account.tasks # => List of tasks
    tr.account.tasks.create(some_params)

## Cities

### Get list of cities

    tr.cities.each do |city|
      city.name
    end

### Find a city using the id

    tr.cities.find(3).name # => "SF Bay Area"

### More informations

More informations: http://taskrabbit.github.com

## TODO

Add:

- Picture and sound upload<commit_msg>Add pages in TODO.<commit_after># TaskRabbit Ruby Gem

Ruby wrapper for TaskRabbit API.

## Installation

    gem install taskrabbit

## Usage Example

### Configuration

In an initializer file.

    Taskrabbit.configure do |config|
      config.client_secret = 'your-client-secret'
    end

## Task

### use the API client

    tr = Taskrabbit::Api.new
    
or with a user token

    tr = Taskrabbit::Api.new(user_token)

### Get the list of all the tasks

    tr = Taskrabbit::Api.new
    # to get the /tasks
    tasks = tr.tasks.all
    # fetch the first task
    tasks.first
    
    tasks.all(:reload => true) # => will redo the query

### Find a task

    tr = Taskrabbit::Api.new
    t = tr.tasks.find(31231) # This actually wont do the request

To request the API:

    t.fetch # force fetching

or simply access a property:

    t.name # will do the query

### Find the tasks of an user

    tr.users.find(user_id).tasks

### Create a task

    tr = Taskrabbit::Api.new(user_token)
    task = tr.tasks.create({:named_price => 32, :name => 'Ikea'})

or 

    task = tr.tasks.new({:named_price => 32, :name => 'Ikea'})
    task.save

### Update a task

    task = tr.tasks.find('some-id')
    task.named_price = 45
    task.save

### Error for tasks creation or update

    tr = Taskrabbit::Api.new(client_secret)
    task = tr.tasks.new
    unless task.save
      task.error # => "Task title can't be blank, \nAmount you are willing to pay is not a number"
      task.errors # => { "messages" => ["Task title can't be blank", "Amount you are willing to pay is not a number"],
                         "fields" => [["name","can't be blank"], ["named_price","is not a number"]] }
    end

## User account

    tr = Taskrabbit::Api.new(client_secret)
    tr.account # => Taskrabbit::User object

    tr.account.tasks # => List of tasks
    tr.account.tasks.create(some_params)

## Cities

### Get list of cities

    tr.cities.each do |city|
      city.name
    end

### Find a city using the id

    tr.cities.find(3).name # => "SF Bay Area"

### More informations

More informations: http://taskrabbit.github.com

## TODO

Add:

- Picture and sound upload
- Pages
{'fraction_non_alphanumeric': 0.12341113935752253, 'fraction_numerical': 0.005546568061012249, 'mean_word_length': 2.7118353344768438, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6754727', 'n_tokens_mistral': 1466, 'n_tokens_neox': 1366, 'n_words': 453}