require "thor"
require "apple_system_status"

module AppleSystemStatus
  class CLI < Thor
    desc "fetch", "Fetch apple system status"
    option :country, desc: "country code. (ex. jp, ca, fr)", default: "us"
    option :title,   desc: "If specified, narrow the service title"
    option :format,  desc: "output format. (ex. plain, json)", default: "plain"
    def fetch
      response = AppleSystemStatus::Crawler.new.perform(
        country: options[:country],
        title:   options[:title],
      )
      puts AppleSystemStatus.format_response(response, options[:format])
    end

    desc "version", "Show apple_system_status version"
    def version
      puts AppleSystemStatus::VERSION
    end
  end
end

require "thor"
require "apple_system_status"

module AppleSystemStatus
  class CLI < Thor
    desc "fetch", "Fetch apple system status"
    option :country, desc: "country code. (ex. jp, ca, fr)", default: "us"
    option :title,   desc: "If specified, narrow the service title"
    option :format,  desc: "output format. (ex. plain, json)", default: "plain"
    def fetch
      response = AppleSystemStatus::Crawler.perform(
        country: options[:country],
        title:   options[:title],
      )
      puts AppleSystemStatus.format_response(response, options[:format])
    end

    desc "version", "Show apple_system_status version"
    def version
      puts AppleSystemStatus::VERSION
    end
  end
end

Use class method instead of instance method
Use class method instead of instance method
