Class: Klimt::Commands::City

Inherits:
Thor
  • Object
show all
Includes:
Rendering
Defined in:
lib/klimt/commands/city.rb

Instance Method Summary collapse

Methods included from Rendering

#jq_installed?, #render, #render_pretty, #render_with_jq

Instance Method Details

#listObject



9
10
11
12
13
14
15
16
# File 'lib/klimt/commands/city.rb', line 9

def list
  file = options[:featured] ? 'featured-cities.json' : 'cities.json'
  uri = "http://artsy-geodata.s3-website-us-east-1.amazonaws.com/partner-cities/#{file}"
  response = Typhoeus.get(uri)
  jq_filter = options[:short] ? '.[] | { full_name, coords }' : '.'
  jq_options = options[:short] ? '-c' : ''
  render response.body, jq_filter: jq_filter, jq_options: jq_options
end