Class: FentonShell::Client
- Inherits:
-
Object
- Object
- FentonShell::Client
- Defined in:
- lib/fenton_shell/client.rb
Overview
Interfaces with the client api on fenton server
Instance Attribute Summary collapse
-
#message ⇒ String
Success or failure message and why.
Instance Method Summary collapse
-
#create(global_options, options) ⇒ String
Creates a new client on fenton server by sending a post request with json from the command line to create the client.
-
#create_with_organization(global_options, options) ⇒ String
Calls create new client then creates an organization for that client via a post request with json from the command line.
Instance Attribute Details
#message ⇒ String
Returns success or failure message and why.
6 7 8 |
# File 'lib/fenton_shell/client.rb', line 6 def @message end |
Instance Method Details
#create(global_options, options) ⇒ String
Creates a new client on fenton server by sending a post request with json from the command line to create the client
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fenton_shell/client.rb', line 15 def create(, ) status, body = client_create(, ) if status == 201 ('Client': ['created!']) true else (body) false end end |
#create_with_organization(global_options, options) ⇒ String
Calls create new client then creates an organization for that client via a post request with json from the command line
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fenton_shell/client.rb', line 34 def create_with_organization(, ) create(, ) if Organization.new.create(, name: [:username], key: [:username]) ('Organization': ['created!']) true else ('Organization': ['not created!']) false end end |