Skip to content

sue445/apple_system_status

Repository files navigation

AppleSystemStatus

Apple System Status scraping library

Gem Version CircleCI Code Climate Test Coverage Coverage Status

Requirements

  • Ruby 3.0+
  • Headless Chrome

Installation

Add this line to your application's Gemfile:

gem 'apple_system_status'

And then execute:

$ bundle

Or install it yourself as:

$ gem install apple_system_status

Usage (via. ruby)

# English
pp AppleSystemStatus::Crawler.perform

{:title=>"System Status as of 12:51 AM JST",
 :services=>
  [{:title=>"App Store",
    :description=>"No Issues: App Store",
    :status=>"allgood"},
   {:title=>"iCloud Account & Sign In",
    :description=>"No Issues: iCloud Account & Sign In",
    :status=>"allgood"},
   # ...
]}

# Japanese
pp AppleSystemStatus::Crawler.perform(country: "jp")

{:title=>"00:53 JST 時点のシステム状況",
 :services=>
  [{:title=>"App Store", :description=>"問題なし: App Store", :status=>"allgood"},
   {:title=>"iCloud ストレージアップグレード",
    :description=>"問題なし: iCloud ストレージアップグレード",
    :status=>"allgood"},
   {:title=>"iTunes Store",
    :description=>"問題なし: iTunes Store",
    :status=>"allgood"},
   # ...
]}

Usage (via. shell)

$ apple_system_status help
Commands:
  apple_system_status fetch           # Fetch apple system status
  apple_system_status help [COMMAND]  # Describe available commands or one specific command
  apple_system_status version         # Show apple_system_status version

$ apple_system_status help fetch
Usage:
  apple_system_status fetch

Options:
  [--country=COUNTRY]  # country code. (e.g. jp, ca, fr)
                       # Default: us
  [--title=TITLE]      # If specified, narrow the service title
  [--format=FORMAT]    # output format. (e.g. plain, json)
                       # Default: plain

Example

$ apple_system_status fetch --country=us --title="iTunes Store" --format=json | jq .
{
  "title": "System Status as of 4:33 PM JST",
  "services": [
    {
      "title": "iTunes Store",
      "description": "No Issues: iTunes Store",
      "status": "allgood"
    }
  ]
}

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake rspec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment. Run bundle exec apple_system_status to use the gem in this directory, ignoring other installed copies of this gem.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sue445/apple_system_status.

License

The gem is available as open source under the terms of the MIT License.