Skip to content
Ruby wrapper for ReferralCandy API
Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
LICENSE
README.md
Rakefile
referral_candy.gemspec

README.md

ReferralCandy Ruby API Client

Installation

gem install 'referral_candy'

Usage

Initialization

Initialize a client with your ReferralCandy credentials

rc = ReferralCandy.new(:access_id => "YOUR_ACCESS_ID", :secret_key => "YOUR_SECRET_KEY")

Verification

Verify your credentials.

response = rc.verify
response.parsed_response # => {"message"=>"Verification Ok"}
response.code            # => 200

API Methods

The ReferralCandy API client will perform the authentication steps for you. This means that you would not be required to pass in the 'timestamp', 'accessID', and 'signature' parameters.

API endpoints are available as methods in the ReferralCandy API client.

E.g.

rc.contacts(:limit => 1).parsed_response
# => {"message"=>"Success", "total_count"=>10000, "contacts"=>[{"id"=>1, "first_name"=>"Yink", "last_name"=>"Teo", "email"=>"hello@referralcandy.com", "purchase_made"=>false, "purchases"=>[], "unsubscribed"=>true}]}

API Responses

The ReferralCandy API client uses HTTParty. API responses are wrapped in HTTParty::Response objects.

rc.verify.class           # => HTTParty::Response
rc.verify.body            # => "{\"message\":\"Verification Ok\"}"
rc.verify.parsed_response # => {"message"=>"Verification Ok"}
rc.verify.code            # => 200
rc.verify.header          # => #<Net::HTTPOK 200 OK readbody=true>

Documentation

API documentation

You can’t perform that action at this time.