Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
  lib
  spec
  .gitignore
  Gemfile
  LICENSE.txt
  README.md
  Rakefile
  protractor.gemspec
Size: Mime:
  README.md

Protractor

A Ruby wrapper for the Protractor REST API.

Installation

Add this line to your application's Gemfile:

gem 'protractor'

And then execute:

$ bundle

Or install it yourself as:

$ gem install protractor

Usage

Configuration

Before you can make calls to Protractor you must configure the library with a valid API Token. You can request a token be generated by Protractor. The API Token ties the API request to a particualr Protractor company id.

There are two ways to configure the gem. You can pass a hash of configuration options when you create a client, or you can use a configure block.

client = Protractor.client(api_key: "YOUR_API_KEY", connection_id: "YOUR_CONNECTION_ID")
Protractor.configure do |config|
  config.api_key = "YOUR_API_KEY"
  config.connection_id = "YOUR_CONNECTION_ID"
end

client = Protractor.client

Available Configurations

Option Description
adapter Which Faraday adapter to use
api_key Your 32 character Protractor API key
api_version Which version of the API to use (default: '1.0')
connection_id Your 32 character Protractor connection ID
endpoint Which API endpoint to use (default: 'GetCRMData.ashx')
test_mode Use the development API endpoint?

Contacts

Obtain a list of contacts from the Protractor API

If not set, the endDate is set to Time.now.

# Get all contacts between March 25 and March 27, 2015
client.contacts(startDate: Time.new(2015, 3, 25), endDate: Time.new(2015, 3, 27))

# Get all contacts since March 25, 2015
client.contacts(startDate: Time.new(2015, 3, 25))

Invoices

Obtain a list of invoices from the Protractor API

# Get all invoices between March 25 and March 27, 2015
client.invoices(startDate: Time.new(2015, 3, 25), endDate: Time.new(2015, 3, 27))

# Get all contacts since March 25, 2015
client.invoices(startDate: Time.new(2015, 3, 25))

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request