Class: Hapyrus::Command::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/hapyrus/command/base.rb

Direct Known Subclasses

Auth, Datasets, Jobs

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



7
8
9
# File 'lib/hapyrus/command/base.rb', line 7

def initialize
  @api_client = ApiClient.new
end

Instance Method Details

#askObject



11
# File 'lib/hapyrus/command/base.rb', line 11

def ask; gets.strip end

#display_indexObject



15
16
17
# File 'lib/hapyrus/command/base.rb', line 15

def display_index
  pp @result.first
end

#display_show(id) ⇒ Object



21
22
23
# File 'lib/hapyrus/command/base.rb', line 21

def display_show(id)
  pp @result
end

#hapyrusObject



10
# File 'lib/hapyrus/command/base.rb', line 10

def hapyrus; @api_client end

#indexObject



12
13
14
# File 'lib/hapyrus/command/base.rb', line 12

def index
  @result = JSON.parse hapyrus.get(class_name_to_path)
end

#show(id) ⇒ Object



18
19
20
# File 'lib/hapyrus/command/base.rb', line 18

def show(id)
  @result = JSON.parse hapyrus.get("#{class_name_to_path}/#{id}")
end