Included Modules

Files

Class Index [+]

Quicksearch

Spreedly

Public Class Methods

configure(site_name, token) click to toggle source

Call this before you start using the API to set things up.

    # File lib/spreedly.rb, line 41
41:   def self.configure(site_name, token)
42:     base_uri "https://spreedly.com/api/v4/#{site_name}"
43:     basic_auth token, 'X'
44:     @site_name = site_name
45:   end
edit_subscriber_url(token) click to toggle source

Generates an edit subscriber for the given subscriber token. The token is returned with the subscriber info (i.e. by Subscriber.find).

    # File lib/spreedly/common.rb, line 36
36:   def self.edit_subscriber_url(token)
37:     "https://spreedly.com/#{site_name}/subscriber_accounts/#{token}"
38:   end
subscribe_url(id, plan, options={}) click to toggle source

Generates a subscribe url for the given user id and plan. Options:

  :screen_name => a screen name for the user (shows up in the admin UI)
  :email => pre-populate the email field
  :first_name => pre-populate the first name field
  :last_name => pre-populate the last name field
    # File lib/spreedly/common.rb, line 18
18:   def self.subscribe_url(id, plan, options={})
19:     ]screen_name email first_name last_name).each do |option|
20:       options[option.to_sym] &&= URI.escape(options[option.to_sym])
21:     end
22: 
23:     screen_name = options.delete(:screen_name)
24:     params = ]email first_name last_name).select{|e| options[e.to_sym]}.collect{|e| "#{e}=#{options[e.to_sym]}"}.join('&')
25: 
26:     url = "https://spreedly.com/#{site_name}/subscribers/#{id}/subscribe/#{plan}"
27:     url << "/#{screen_name}" if screen_name
28:     url << '?' << params unless params == ''
29: 
30:     url
31:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.