-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccount-requests.rb
More file actions
69 lines (60 loc) · 1.76 KB
/
account-requests.rb
File metadata and controls
69 lines (60 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
def initiate_client
HelloSign::Client.new :api_key => ENV['API_KEY']
end
def input
gets.chomp
end
def account
client = initiate_client
account = client.get_account
puts <<-EOS
Get Account
-----
Account ID: #{account.account_id}
Email Address: #{account.email_address}
Callback URL: #{account.callback_url}
HelloSign Paid Account: #{account.is_paid_hs}
HelloFax Paid Account: #{account.is_paid_hf}
API Signature Requests Left: #{account.quotas.api_signature_requests_left}
EOS
end
def update_account
client = initiate_client
puts "Enter your new account callback URL"
url = input
account = client.update_account :callback_url => url
puts <<-EOS
Update Account
-----
Account ID: #{account.account_id}
Email Address: #{account.email_address}
Callback URL: #{account.callback_url}
HelloSign Paid Account: #{account.is_paid_hs}
HelloFax Paid Account: #{account.is_paid_hf}
API Signature Requests Left: #{account.quotas.api_signature_requests_left}
EOS
end
def verify_account(email)
client = initiate_client
client.verify :email_address => email
end
def create_account
client = initiate_client
puts "Enter email you'd like to use for the new HelloSign account"
email = input
if verify_account(email)
puts "An account for #{email} already exists!"
else
account = client.create_account :email_address => email
puts <<-EOS
Create Account
-----
Account ID: #{account.account_id}
Email Address: #{account.email_address}
Callback URL: #{account.callback_url}
HelloSign Paid Account: #{account.is_paid_hs}
HelloFax Paid Account: #{account.is_paid_hf}
API Signature Requests Left: #{account.quotas.api_signature_requests_left}
EOS
end
end