Skip to content

Commit

Permalink
Updated readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
gabifija committed Apr 6, 2018
1 parent 245d69b commit 0cf530b
Showing 1 changed file with 35 additions and 45 deletions.
80 changes: 35 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
[![Travis CI][travis_ci_badge]][travis_ci]
[![Coveralls][coveralls_badge]][coveralls]
[![Code Climate][code_climate_badge]][code_climate]

# Filestack Ruby SDK
<a href="https://www.filestack.com"><img src="https://filestack.com/themes/filestack/assets/images/press-articles/color.svg" align="left" hspace="10" vspace="6"></a>
This is the official Ruby SDK for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.

## Resources

* [Filestack](https://www.filestack.com)
* [Documentation](https://www.filestack.com/docs/sdks?ruby)
* [API Reference](https://filestack.github.io/filestack-ruby)

## Installing
<p align="center"><img src="https://filestack.com/themes/filestack/assets/images/press-articles/color.svg" align="center" width="100"/></p>
<h1 align="center">Filestack Ruby SDK</h1>
<p align="center">
<a href="https://travis-ci.org/filestack/filestack-ruby.svg?branch=master">
<img src="https://img.shields.io/travis/filestack/filestack-ruby/master.svg?longCache=true&style=flat-square">
</a>
<a href="https://coveralls.io/github/filestack/filestack-ruby?branch=master">
<img src="https://img.shields.io/coveralls/github/filestack/filestack-ruby/master.svg?longCache=true&style=flat-square">
</a>
</p>
<p align="center">
Ruby SDK for Filestack API and content management system.
</p>

**Important: This is the readme for 2.1.0.**
A recent change (2.1.0) has renamed the `Client` to `FilestackClient`, and the `Filelink` to `FilestackFilelink`. Please make neccessary changes before upgrading to newest release if you run 2.0.1 or 2.0.0. This was to address namespace concerns by users with models and attributes named `Client`, and to be more consistent.

## Overview

* A multi-part uploader powered on the backend by the [Filestack CIN](https://www.filestack.com/products/content-ingestion-network).
* An interface to the [Filestack Processing Engine](https://www.filestack.com/docs/image-transformations) for transforming assets via URLs.
* The Filestack Picker - an upload widget for the web that integrates over a dozen cloud providers and provides pre-upload image editing.

## Installation

Add this line to your application's Gemfile:

Expand All @@ -30,19 +39,16 @@ Or install it yourself as:

## Usage

## IMPORTANT

A recent change (2.1.0) has renamed the Client to FilestackClient, and the Filelink to FilestackFilelink. Please make neccessary changes before upgrading to newest release if you run 2.0.1 or 2.0.0. This was to address namespace concerns by users with models and attributes named Client, and to be more consistent.

### Import
```ruby
require 'filestack'
```
Intialize the client using your API key, and security if you are using it.
Intialize the client using your API key, and security if you are using it.
```ruby
client = FilestackClient.new('YOUR_API_KEY', security: security_object)
```
### Uploading
Filestack uses multipart uploading by default, which is faster for larger files. This can be turned off by passing in ```multipart: false```. Multipart is disabled when uploading external URLs.
Filestack uses multipart uploading by default, which is faster for larger files. This can be turned off by passing in ```multipart: false```. Multipart is disabled when uploading external URLs.
```ruby
filelink = client.upload(filepath: '/path/to/file')

Expand All @@ -52,17 +58,17 @@ filelink = client.upload(external_url: 'http://someurl.com')
```

### Security
If security is enabled on your account, or if you are using certain actions that require security (delete, overwrite and certain transformations), you will need to create a security object and pass it into the client on instantiation.
If security is enabled on your account, or if you are using certain actions that require security (delete, overwrite and certain transformations), you will need to create a security object and pass it into the client on instantiation.

```ruby
security = FilestackSecurity.new('YOUR_APP_SECRET', options: {call: %w[read store pick]})
client = FilestackClient.new('YOUR_API_KEY', security: security)
```

### Using FilestackFilelinks
FilestackFilelink objects are representation of a file handle. You can download, get raw file content, delete and overwrite file handles directly. Security is required for overwrite and delete methods.
FilestackFilelink objects are representation of a file handle. You can download, get raw file content, delete and overwrite file handles directly. Security is required for overwrite and delete methods.

### Transformations
### Transformations
Transforms can be initiated one of two ways. The first, by calling ```transform``` on a filelink:

```ruby
Expand Down Expand Up @@ -105,27 +111,27 @@ tags = filelink.tags

This will return a hash with labels and their associated confidence:

```ruby
```ruby
{
"auto" => {
"art"=>73,
"big cats"=>79,
"carnivoran"=>80,
"cartoon"=>93,
"cat like mammal"=>92,
"fauna"=>86, "mammal"=>92,
"small to medium sized cats"=>89,
"fauna"=>86, "mammal"=>92,
"small to medium sized cats"=>89,
"tiger"=>92,
"vertebrate"=>90},
"user" => nil
}
```

SFW is called the same way, but returns a boolean value (true == safe-for-work, false == not-safe-for-work).
SFW is called the same way, but returns a boolean value (true == safe-for-work, false == not-safe-for-work).

```ruby
sfw = filelink.sfw
```
```

## Versioning

Expand All @@ -134,19 +140,3 @@ Filestack Ruby SDK follows the [Semantic Versioning](http://semver.org/).
## Issues

If you have problems, please create a [Github Issue](https://github.com/filestack/filestack-ruby/issues).

## Contributing

Please see [CONTRIBUTING.md](https://github.com/filestack/filestack-ruby/CONTRIBUTING.md) for details.

## Credits

Thank you to all the [contributors](https://github.com/filestack/filestack-ruby/graphs/contributors).

[travis_ci]: http://travis-ci.org/filestack/filestack-ruby

[travis_ci_badge]: https://travis-ci.org/filestack/filestack-ruby.svg?branch=master
[code_climate]: https://codeclimate.com/github/filestack/filestack-ruby
[code_climate_badge]: https://codeclimate.com/github/filestack/filestack-ruby.png
[coveralls]: https://coveralls.io/github/filestack/filestack-ruby?branch=master
[coveralls_badge]: https://coveralls.io/repos/github/filestack/filestack-ruby/badge.svg?branch=master

0 comments on commit 0cf530b

Please sign in to comment.