class WuParty

Constants

API_VERSION

Public Class Methods

login(integration_key, email, password, account = nil) click to toggle source

uses the Login API to fetch a user's API key

# File lib/wuparty.rb, line 32
def self.login(integration_key, email, password, account = nil)
  result = post(
    'https://wufoo.com/api/v3/login.json',
    body: {
      integrationKey: integration_key,
      email:          email,
      password:       password,
      subdomain:      account
    }
  )
  raise ConnectionError, result if result.is_a?(String)
  raise HTTPError.new(result['HTTPCode'], result['Text']) if result['HTTPCode']
  result
end
new(account, api_key, domain: 'wufoo.com', account_prefix: nil) click to toggle source

Create a new WuParty object

# File lib/wuparty.rb, line 48
def initialize(account, api_key, domain: 'wufoo.com', account_prefix: nil)
  @account = account
  @api_key = api_key
  @domain = domain
  @account_prefix = account_prefix || @account
  @field_numbers = {}
end

Public Instance Methods

add_webhook(form_id, url, metadata = false, handshake_key = '') click to toggle source
# File lib/wuparty.rb, line 83
def add_webhook(form_id, url, metadata = false, handshake_key = '')
  put(
    "forms/#{form_id}/webhooks",
    body: {
      'url' => url,
      'handshakeKey' => handshake_key,
      'metadata' => metadata
    }
  )
end
delete_webhook(form_id, webhook_hash) click to toggle source
# File lib/wuparty.rb, line 94
def delete_webhook(form_id, webhook_hash)
  delete("forms/#{form_id}/webhooks/#{webhook_hash}")
end
form(form_id) click to toggle source

Returns details about the specified form.

# File lib/wuparty.rb, line 78
def form(form_id)
  return unless (f = get("forms/#{form_id}")['Forms'])
  Form.new(f.first['Url'], party: self, details: f.first)
end
forms() click to toggle source

Returns list of forms and details accessible by the user account.

# File lib/wuparty.rb, line 57
def forms
  get(:forms)['Forms'].map do |details|
    Form.new(details['Url'], party: self, details: details)
  end
end
report(report_id) click to toggle source

Returns details about the specified report.

# File lib/wuparty.rb, line 99
def report(report_id)
  return unless (r = get("reports/#{report_id}")['Reports'])
  Report.new(r.first['Url'], party: self, details: r.first)
end
reports() click to toggle source

Returns list of reports and details accessible by the user account.

# File lib/wuparty.rb, line 64
def reports
  get(:reports)['Reports'].map do |details|
    Report.new(details['Url'], party: self, details: details)
  end
end
users() click to toggle source

Returns list of users and details.

# File lib/wuparty.rb, line 71
def users
  get(:users)['Users'].map do |details|
    User.new(details['Url'], party: self, details: details)
  end
end