Class: Hsp::Cli::Platforms

Inherits:
Thor
  • Object
show all
Defined in:
lib/hsp/cli/platforms.rb

Instance Method Summary collapse

Instance Method Details

#listObject



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/hsp/cli/platforms.rb', line 28

def list
  m = Marketplace.new
  query = {
      page: 1,
      per_page: 10
  }
  query[:page] = options[:page].to_i if options[:page]
  query[:per_page] = options[:per_page].to_i if options[:per_page]
  response = HTTParty.get(m.platforms_url(options[:user_id]), query: query, headers: Hsp::Client.headers)
  json = JSON.parse(response.body)
  # puts json
  print_platforms(json)
end

#showObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/hsp/cli/platforms.rb', line 45

def show
    m = Marketplace.new
    response = HTTParty.get(m.platforms_url(options[:user_id], options[:platform_id]), headers: Hsp::Client.headers)
    json = JSON.parse(response.body)
    # puts json
    puts ''
    puts json['name']
    puts_bar
    #   puts json['description']
    puts "ID: #{json['id']}"
    puts "Owner (User ID): #{json['user_id']}"
    puts "Secret: #{json['public_key']}"
    puts "Created: #{json['created_at']}"
    puts "Updated: #{json['updated_at']}"
    puts "URL: #{json['url']}"
    puts "Path: #{json['path']}"
    puts ''
end