README.md in fanforce-api-0.31.0 vs README.md in fanforce-api-1.0.0

- old
+ new

@@ -1,133 +1,64 @@ -## 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 +Add fanforce-api to your Gemfile ``` 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 +gem 'fanforce-api' ``` -### Making Your First Call +Require fanforce/api and initialize an instance ``` ruby -# get your api access info -ff.get('/access_info', {}) -``` +require 'fanforce/api' -## Full REST Access - -### GET - -``` ruby -ff.get('/', {}) +# Initialize a new Fanforce::API instance with your api_key +ff = Fanforce::API.new('00000000-0000-0000-0000-000000000000') ``` -### POST +## Making Your First Call -``` ruby -ff.post('/', {}) -``` +Get your organization details... -### PUT - ``` ruby -ff.put('/', {}) +ff.get('/organization') ``` -### 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| +Fanforce::API.config do |config| config.logging = true end ``` -For more info, see RestClient.logging. + +## Error Handling + +```ruby +begin + ff.get('/nonexistent_method') +rescue Fanforce::API::Error => e + puts e.curl_command +end +``` ## More Information Visit the Fanforce Developers site to explore the full API access methods available. \ No newline at end of file