Skip to content

Commit 52c8b2e

Browse files
author
CloudHero
committed
Added feedback option
1 parent c31f469 commit 52c8b2e

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

hero

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ def log_response(response):
137137
class OrderedHeroCommands(click.Group):
138138

139139
COMMANDS_ORDER = ['login', 'register', 'provider', 'integration',
140-
'environment', 'node', 'docker', 'ssh', 'logout']
140+
'environment', 'node', 'docker', 'ssh', 'logout',
141+
'feedback']
141142

142143
COMMANDS_ALIASES = {
143144
'env': 'environment'
@@ -492,6 +493,20 @@ def remove_integration(**kwargs):
492493
cloud_hero.delete_integration(integration_id)
493494

494495

496+
# ------------------------------------------------------------------------
497+
# FEEDBACK
498+
# ------------------------------------------------------------------------
499+
@hero_cli.command('feedback', help='Send feedback to CloudHero team')
500+
def send_feedback():
501+
user_prompt = 'Leave your thoughts for the CloudHero team:\n'
502+
feedback = click.prompt(user_prompt, prompt_suffix='')
503+
feedback_data = {
504+
'feedback': feedback,
505+
'user': token
506+
}
507+
cloud_hero.send_feedback(feedback_data)
508+
509+
495510
# ------------------------------------------------------------------------
496511
# SSH
497512
# ------------------------------------------------------------------------

lib/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# API-related constants.
55
# https://docs.cloudhero.io
6-
CLOUD_HERO_URI = 'http://s.cloudhero.io'
6+
CLOUD_HERO_URI = 'http://d.cloudhero.io'
77
CLOUD_HERO_TOKEN_ENV_VARIABLE = 'CLOUD_HERO_TOKEN'
88
CLOUD_HERO_USER_AGENT = 'cloudhero-cli'
99

lib/pyhero.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
'environments': '/environments',
2525
'applications': '/applications',
2626
'swarm': '/swarm',
27+
'feedback': '/feedback'
2728
}
2829

2930

@@ -167,6 +168,10 @@ def scale_down_node(self, environment_id, data):
167168
result = self.delete_json(self._scale_endpoint(environment_id), data)
168169
return self._result(result)
169170

171+
def send_feedback(self, data):
172+
return self._result(self.post_json(ENDPOINTS['feedback'],
173+
data=data))
174+
170175
@cache_to_file(CLOUD_HERO_CACHE_OPTIONS, ttl=CLIENT_CACHE_OPTIONS_TTL)
171176
def show_options(self, endpoint):
172177
"""

0 commit comments

Comments
 (0)