<commit_before># SyncTV Ruby Client

Full client access to [SyncTV's API](http://api.synctv.com/v2/) to use in your gems and Rails apps. The access works based on [ActiveResource](https://github.com/rails/activeresource)

## Installation

Add this line to your application's Gemfile:

    gem 'synctv-ruby-client'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install synctv-ruby-client

## Usage

Automatically sign all outgoing ActiveResource requests from your app.

``` ruby
    Synctv::Client::Resource.site             = "https://v2-dev.synctv.com"
    Synctv::Client::Resource.client_key       = "<your_client_key_goes_here>"
    Synctv::Client::Resource.device_uid       = "<specify a randmom string>"

    # optionally, specify account information:
    Synctv::Client::Resource.account_email    = "<specify a user account email>"
    Synctv::Client::Resource.account_password = "<specify a user account password>"
    
    Synctv::Client::Resources.Media.find(1) # -> returns first media instance
    
    # for convenience, include the namespace:
    include Synctv::Client::Resources

    # index
    Media.all
    
    # get
    @media = Media.find(1) # -> returns first media instance
    
    # put
    @media.name = "Foobar"
    @media.save
    
    # delete
    @media.delete
    
    # count
    Media.count
```

### Available Resources

The following resources are supported under the `Synctv::Client::Resources` namespace:

``` ruby
    Account
    AccountType
    Bundle
    BundleType
    Container
    ContainerGroup
    ContainerType
    Contributor
    Invoice
    Media
    MediaType
    Ownership
    OwnershipPolicy
    Platform
    PlatformType
    Program
    Schedule
```

### Filters

The easiest way to create a query against a resource is by using the `where` "scope" and the available "Request Fields", example: [Media request](http://api.synctv.com/v2/admin/Api/V2/MediaController.html).

``` ruby
    Media.where(:ids => [1, 2, 3])<commit_msg>Improving README<commit_after># SyncTV Ruby Client

Full client access to [SyncTV's API](http://api.synctv.com/v2/) to use in your gems and Rails apps. The access works based on [ActiveResource](https://github.com/rails/activeresource)

## Installation

Add this line to your application's Gemfile:

    gem 'synctv-ruby-client'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install synctv-ruby-client

## Usage

Automatically sign all outgoing ActiveResource requests from your app.

``` ruby
    Synctv::Client::Resource.site             = "https://v2-dev.synctv.com"
    Synctv::Client::Resource.client_key       = "<your_client_key_goes_here>"
    Synctv::Client::Resource.device_uid       = "<specify a randmom string>"

    # optionally, specify account information:
    Synctv::Client::Resource.account_email    = "<specify a user account email>"
    Synctv::Client::Resource.account_password = "<<PASSWORD> user account password>"
    
    Synctv::Client::Resources.Media.find(1) # -> returns first media instance
    
    # for convenience, include the namespace:
    include Synctv::Client::Resources

    # index
    Media.all
    
    # get
    @media = Media.find(1) # -> returns first media instance
    
    # put
    @media.name = "Foobar"
    @media.save
    
    # delete
    @media.delete
    
    # count
    Media.count
```

### Available Resources

The following resources are supported under the `Synctv::Client::Resources` namespace:

``` ruby
    Account
    AccountType
    Bundle
    BundleType
    Container
    ContainerGroup
    ContainerType
    Contributor
    Ingest::Image
    Ingest::Video
    Invoice
    Media
    MediaType
    Ownership
    OwnershipPolicy::OwnershipFactory
    OwnershipPolicy::PriceRule
    OwnershipPolicy::ViewRule
    OwnershipPolicy
    Platform
    PlatformType
    Program
    Schedule
```

### Filters

The easiest way to create a query against a resource is by using the `where` "scope" and the available "Request Fields", example: [Media request](http://api.synctv.com/v2/admin/Api/V2/MediaController.html).

``` ruby
    Media.where(:ids => [1, 2, 3])
{'fraction_non_alphanumeric': 0.10171125572427091, 'fraction_numerical': 0.004338394793926247, 'mean_word_length': 3.1417165668662674, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 18, 'https://': 4, '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': '5335683', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1207, 'n_words': 344}