Sha256: db113aff36eeb496c0e86a9392192e4c48b1552d12f213602fab8be016169756
Contents?: true
Size: 1.74 KB
Versions: 22
Compression:
Stored size: 1.74 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/api' # put your own credentials here api_key = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' # set up a client to talk to the Fanforce API ff = Fanforce::API.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
22 entries across 22 versions & 1 rubygems