Sha256: 43226635030d195e72c120e85656bb2e2164dc0737e793028bc862e2174400f2

Contents?: true

Size: 1.73 KB

Versions: 36

Compression:

Stored size: 1.73 KB

Contents

## Install

Via rubygems.org:

```
$ gem install fanforce
```

To build and install the development branch yourself from the latest source:

```
$ git clone git@github.com:mlabs/fanforce-ruby.git
$ cd fanforce-ruby
$ git checkout master
$ rake gem
$ gem install pkg/fanforce-{version}
```

## Getting Started

### Set It Up

``` ruby
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'fanforce'

# put your own credentials here
api_key = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

# set up a client to talk to the Fanforce API
ff = Fanforce.new api_key
```

### Making Your First Call

``` ruby
# get your api access info
ff.get('/access_info', {})
```

## Full REST Access

### GET

``` ruby
ff.get('/', {})
```

### POST

``` ruby
ff.post('/', {})
```

### PUT

``` ruby
ff.put('/', {})
```

### DELETE

``` ruby
ff.delete('/')
```

## Error Handling

```ruby
begin
    ff.get('/bad_page')
rescue Fanforce::Error => e
    puts e.curl_command
end
```

e.curl_command
e.response_code
e.response_body
e.request_url
e.request_params

BadRequestError

## Utils

ff.get_url(path, query_params)

ff.curl_command(method, path, query_params)

ff.validate_auth

ff.to_query_string

ff.compile_jquery_tmpls

ff.decode_json

ff.parse_url

ff.remove_sensitive_params

ff.remove_internal_params

## Handling Results

response.result
response.results

response.total_results
response.current_results
response.current_page
response.total_pages

## Paging

response.prev_url
response.next_url

## Logging

By default logging is turned off.
```ruby
Fanforce.config do |config|
  config.logging = true
end
```

For more info, see RestClient.logging.

## More Information

Visit the Fanforce Developers site to explore the full API access methods available.

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
fanforce-0.7.2 README.md
fanforce-0.7.1 README.md
fanforce-0.7.0 README.md
fanforce-0.6.4 README.md
fanforce-0.6.3 README.md
fanforce-0.6.2 README.md
fanforce-0.6.1 README.md
fanforce-0.6.0 README.md
fanforce-0.5.10 README.md
fanforce-0.5.9 README.md
fanforce-0.5.8 README.md
fanforce-0.5.7 README.md
fanforce-0.5.6 README.md
fanforce-0.5.5 README.md
fanforce-0.5.4 README.md
fanforce-0.5.3 README.md