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
|
# File 'lib/zen_pro/api/project_template.rb', line 7
def fetch_details(id)
response = RestClient.get("#{api_url}/#{id}", (id))
JSON.parse(response)
rescue RestClient::ExceptionWithResponse => e
prompt = TTY::Prompt.new
prompt.say " You can logout and login again if the API Token had some typo/mistake:\n\n 1. Logout first: zen_pro logout \#{id}\n 2. Login back and add correct API Token: zen_pro g \#{id}\n RE_LOGIN_MESSAGE\n\n json_response = string_to_json(e.response)\n\n if e.response.code == 403 && json_response &&\n json_response[\"is_subscription_inactive\"]\n print TTY::Box.error <<~SUBSCRIPTION_EXPIRED_INSTRUCTIONS\n It looks like your subscription has either expired or you are on Free plan.\n\n You can upgrade your account from the following URL:\n\n https://zeroconfigrails.com/account/teams/\#{json_response[\"team_id\"]}/billing/subscriptions\n SUBSCRIPTION_EXPIRED_INSTRUCTIONS\n end\n\n raise(e)\nend\n" if e.response.code == 401
|