Skip to content

Commit

Permalink
Merge remote-tracking branch 'BenKnigge/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
seven1m committed Mar 3, 2019
2 parents 6e782af + 8d476fd commit 4159079
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
20 changes: 20 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,28 @@ Make sure you have latest version installed (1.0.0 or higher).
API_KEY = 'AAAA-BBBB-CCCC-DDDD'
FORM_ID = 'my-form-id'

ENDPOINT_DOMAIN = 'wufoo.com'
ENDPOINT_PREFIX = 'YourPrefix'

wufoo = WuParty.new(ACCOUNT, API_KEY)

The endpoint_domain and endpoint_prefix are optional parameters.
In some cases the endpoint_domain will be something other than wufoo.com for exacmple wufoo.eu

The endpoint_prefix will be the prefix that was assigned to you by wufoo. In some cases this is different than the account name.

Examples with optional parameters defined.

wufoo = WuParty.new(ACCOUNT, API_KEY, ENDPOINT_DOMAIN)
wufoo = WuParty.new(ACCOUNT, API_KEY, ENDPOINT_DOMAIN, ENDPOINT_PREFIX)








=== Login

result = WuParty.login(myIntegrationKey, users_email, users_password)
Expand Down
9 changes: 5 additions & 4 deletions lib/wuparty.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class WuParty
include HTTParty
format :json

VERSION = '1.2.3'
VERSION = '1.2.4'

# Represents a general error connecting to the Wufoo service
class ConnectionError < RuntimeError; end
Expand All @@ -24,7 +24,6 @@ def initialize(code, message) # :nodoc:
attr_reader :code
end

ENDPOINT = 'https://%s.wufoo.com/api/v3'
API_VERSION = '3.0'

# uses the Login API to fetch a user's API key
Expand All @@ -40,9 +39,11 @@ def self.login(integration_key, email, password, account = nil)
end

# Create a new WuParty object
def initialize(account, api_key)
def initialize(account, api_key, endpoint_domain = 'wufoo.com', endpoint_prefix = nil )
@account = account
@api_key = api_key
@endpoint_domain = endpoint_domain
@endpoint_prefix = if (endpoint_prefix == nil) then @account else endpoint_prefix end
@field_numbers = {}
end

Expand Down Expand Up @@ -108,7 +109,7 @@ def delete(method, options={}) # :nodoc:
private

def base_url
ENDPOINT % @account
'https://' + @endpoint_prefix + '.' + @endpoint_domain + '/api/v3'
end

def handle_http_verb(verb, action, options={})
Expand Down

0 comments on commit 4159079

Please sign in to comment.