Class: Bcli::Commands::News
- Inherits:
-
Bcli::Command
- Object
- Bcli::Command
- Bcli::Commands::News
- Defined in:
- lib/bcli/commands/news.rb
Instance Method Summary collapse
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(options) ⇒ News
constructor
A new instance of News.
Methods inherited from Bcli::Command
#ask, #client, #config, #credentials, #download, #link_to, #logger, #open_in_browser, #parse_json, #pastel, #prompt
Constructor Details
#initialize(options) ⇒ News
Returns a new instance of News.
8 9 10 |
# File 'lib/bcli/commands/news.rb', line 8 def initialize() @options = end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/bcli/commands/news.rb', line 12 def execute(input: $stdin, output: $stdout) res = client.get("/news") if res.success? handle_search_response(JSON.parse(res.body.to_s)) else puts pastel.red "Something went wrong." puts pastel.red res.body end end |