Class: Nrcmd::Apps::Hosts
- Inherits:
-
Thor
- Object
- Thor
- Nrcmd::Apps::Hosts
- Defined in:
- lib/nrcmd/apps/hosts/cli.rb
Defined Under Namespace
Classes: Metrics
Constant Summary collapse
- URL =
'https://api.newrelic.com/v2'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.banner(task, namespace = false, subcommand = true) ⇒ Object
44 45 46 |
# File 'lib/nrcmd/apps/hosts/cli.rb', line 44 def self.(task, namespace = false, subcommand = true) super end |
Instance Method Details
#list(app_id) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/nrcmd/apps/hosts/cli.rb', line 22 def list(app_id) uri = URL + "/applications/#{app_id}/hosts.json" filter_param = "" ["filter"].gsub(" ", "").split(',').each do |filter| fkv = filter.split('=') filter_param << "filter[#{fkv[0]}]=#{fkv[1]}&" end res = Nrcmd::Http.get(uri, {}, filter_param) result = JSON.parse(res.body) print JSON[ result["application_hosts"] ] end |