Skip to content

SiftScience/sift-partner-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Requirements

  • Ruby 1.8.7 or above. (Ruby 1.8.6 might work if you load ActiveSupport.)

  • HTTParty, 0.13.1 or greater

  • Multi Json, 1.0 or greater

  • sift, 1.1.6.2 or greater

For development only:

  • bundler

  • rspec, 2.14.1 or greater

  • webmock, 1.16 or greater

  • rake, any version

Installation

If you want to build the gem from source:

$ gem build sift-partner.gemspec

Alternatively, you can install the gem from Rubyforge:

$ gem install sift-partner

Usage

require "sift-partner"

# you can get these values from the console
partner_client = SiftPartner::Client.new(partner_api_key, partner_acct_id)

# create a new account for a given merchant
merchant_account_response = partner_client.new_account(
  "merchantsite.com", # the url for the merchant's site
  "[email protected]", # an email belonging to the merchant
  "[email protected]", # an email used to log in to Sift
  "s0m3l0ngp455w0rd" # password associated with that log in
)

merchant_account_response.ok?  # returns true or false
merchant_account_response.body  # API response body
merchant_account_response.http_status_code  # HTTP response code, 200 is ok.

# get a listing of all your accounts
all_accounts = partner_client.get_accounts

# config http notifications
cfg = {
    :http_notification_threshold => 0.15,
    :http_notification_url => "http://api.partner.com/notify?id=%s"
}
updated = partner_client.update_notification_config(cfg)

Building

Building and publishing the gem is captured by the following steps:

$ gem build sift-partner.gemspec
$ gem push sift-partner<current version>.gem

$ bundle
$ rake -T
$ rake build
$ rake install
$ rake release

Testing

To run the various tests use the rake command as follows:

$ rake spec