apple_system_status 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a4e96fb9bbe4297d0c971a83dc754086663d204
4
- data.tar.gz: fc764df865c06a00a72d284a758ba43c771e67fb
3
+ metadata.gz: f1a58ae11b2f0d5a74d3cb22334a73b5290d74e2
4
+ data.tar.gz: 680b516048aacd35bb5ad667bb9665e6ae89c323
5
5
  SHA512:
6
- metadata.gz: 65bc6a11bb389853aeed28e19852af6c754877ae6e766d1574fd979faaba242e5c656ae2e5cd28cce3f3ff87c21f759d9e76054fd106b9b71d425d5f61ee3b7b
7
- data.tar.gz: cb02316b7f13b94c16e1bb289e8435cead4c9c50689d514031669757bbb8b69b9329e6a23d204256810809bcb8fcce3e0ed8c3e2dee55b498650c6305ef926ce
6
+ metadata.gz: 9ba83ceb230bc93b249aa5b989f95321701917363978ef67926b07441d630f63df6560a43685db1f2dfba9d6282c22c99f9d3c0a80d2f5cf3c48766b07d6fe9a
7
+ data.tar.gz: 8d8808522660767f8c61ee4a0104bc3d312690517e2baaa2b2cb0a2d225af37b5ba9760fb5ff453560f394437484d2edd9699e2f591d61807b397db286c8448e
data/.travis.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.1
4
- - 2.2
4
+ - 2.2.2
5
+ - 2.3.1
5
6
  - ruby-head
6
7
  before_script:
7
8
  - export CI=true
data/CHANGELOG.md ADDED
@@ -0,0 +1,40 @@
1
+ # Change Log
2
+
3
+ ## [v0.1.1](https://github.com/sue445/apple_system_status/tree/v0.1.1) (2015/09/05)
4
+ [Full Changelog](https://github.com/sue445/apple_system_status/compare/v0.1.0...v0.1.1)
5
+
6
+ **Merged pull requests:**
7
+
8
+ - ignore js errors [\#10](https://github.com/sue445/apple_system_status/pull/10) ([sue445](https://github.com/sue445))
9
+
10
+ ## [v0.1.0](https://github.com/sue445/apple_system_status/tree/v0.1.0) (2015/07/28)
11
+ [Full Changelog](https://github.com/sue445/apple_system_status/compare/v0.1.0.beta3...v0.1.0)
12
+
13
+ ## [v0.1.0.beta3](https://github.com/sue445/apple_system_status/tree/v0.1.0.beta3) (2015/07/26)
14
+ [Full Changelog](https://github.com/sue445/apple_system_status/compare/v0.1.0.beta2...v0.1.0.beta3)
15
+
16
+ **Merged pull requests:**
17
+
18
+ - Add title arg to perform [\#9](https://github.com/sue445/apple_system_status/pull/9) ([sue445](https://github.com/sue445))
19
+ - Support: country is blank and us [\#8](https://github.com/sue445/apple_system_status/pull/8) ([sue445](https://github.com/sue445))
20
+ - Refactor: status\(es\) -\> service\(s\) [\#7](https://github.com/sue445/apple_system_status/pull/7) ([sue445](https://github.com/sue445))
21
+ - sort by title [\#6](https://github.com/sue445/apple_system_status/pull/6) ([sue445](https://github.com/sue445))
22
+ - Write readme [\#4](https://github.com/sue445/apple_system_status/pull/4) ([sue445](https://github.com/sue445))
23
+
24
+ ## [v0.1.0.beta2](https://github.com/sue445/apple_system_status/tree/v0.1.0.beta2) (2015/07/25)
25
+ [Full Changelog](https://github.com/sue445/apple_system_status/compare/v0.1.0.beta1...v0.1.0.beta2)
26
+
27
+ **Merged pull requests:**
28
+
29
+ - Fix error when exists blank cell [\#5](https://github.com/sue445/apple_system_status/pull/5) ([sue445](https://github.com/sue445))
30
+
31
+ ## [v0.1.0.beta1](https://github.com/sue445/apple_system_status/tree/v0.1.0.beta1) (2015/07/23)
32
+ **Merged pull requests:**
33
+
34
+ - refactor [\#3](https://github.com/sue445/apple_system_status/pull/3) ([sue445](https://github.com/sue445))
35
+ - Impl cli [\#2](https://github.com/sue445/apple_system_status/pull/2) ([sue445](https://github.com/sue445))
36
+ - Setup travis [\#1](https://github.com/sue445/apple_system_status/pull/1) ([sue445](https://github.com/sue445))
37
+
38
+
39
+
40
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Gemfile CHANGED
@@ -2,3 +2,11 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in apple_system_status.gemspec
4
4
  gemspec
5
+
6
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.2")
7
+ # NOTE: activesupport 5.x supports only ruby 2.2.2+
8
+ gem "activesupport", ">= 4.0.0", "< 5.0.0"
9
+
10
+ # NOTE: rack 2.x supports only ruby 2.2.2+
11
+ gem "rack", "< 2.0.0"
12
+ end
data/README.md CHANGED
@@ -31,10 +31,8 @@ Or install it yourself as:
31
31
 
32
32
  ## Usage (via. ruby)
33
33
  ```ruby
34
- crawler = AppleSystemStatus::Crawler.new
35
-
36
34
  # English
37
- pp crawler.perform
35
+ pp AppleSystemStatus::Crawler.perform
38
36
 
39
37
  {:title=>"System Status as of 12:51 AM JST",
40
38
  :services=>
@@ -48,7 +46,7 @@ pp crawler.perform
48
46
  ]}
49
47
 
50
48
  # Japanese
51
- pp crawler.perform("jp")
49
+ pp AppleSystemStatus::Crawler.perform(country: "jp")
52
50
 
53
51
  {:title=>"00:53 JST 時点のシステム状況",
54
52
  :services=>
@@ -76,13 +74,28 @@ Usage:
76
74
  apple_system_status fetch
77
75
 
78
76
  Options:
79
- [--country=COUNTRY] # country code. (ex. jp, ca, fr)
77
+ [--country=COUNTRY] # country code. (e.g. jp, ca, fr)
80
78
  # Default: us
81
79
  [--title=TITLE] # If specified, narrow the service title
82
- [--format=FORMAT] # output format. (ex. plain, json)
80
+ [--format=FORMAT] # output format. (e.g. plain, json)
83
81
  # Default: plain
84
82
  ```
85
83
 
84
+ ### Example
85
+ ```sh
86
+ $ apple_system_status fetch --country=us --title="iTunes Store" --format=json | jq .
87
+ {
88
+ "title": "System Status as of 4:33 PM JST",
89
+ "services": [
90
+ {
91
+ "title": "iTunes Store",
92
+ "description": "No Issues: iTunes Store",
93
+ "status": "allgood"
94
+ }
95
+ ]
96
+ }
97
+ ```
98
+
86
99
  ## Development
87
100
 
88
101
  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.
@@ -4,11 +4,11 @@ require "apple_system_status"
4
4
  module AppleSystemStatus
5
5
  class CLI < Thor
6
6
  desc "fetch", "Fetch apple system status"
7
- option :country, desc: "country code. (ex. jp, ca, fr)", default: "us"
7
+ option :country, desc: "country code. (e.g. jp, ca, fr)", default: "us"
8
8
  option :title, desc: "If specified, narrow the service title"
9
- option :format, desc: "output format. (ex. plain, json)", default: "plain"
9
+ option :format, desc: "output format. (e.g. plain, json)", default: "plain"
10
10
  def fetch
11
- response = AppleSystemStatus::Crawler.new.perform(
11
+ response = AppleSystemStatus::Crawler.perform(
12
12
  country: options[:country],
13
13
  title: options[:title],
14
14
  )
@@ -14,8 +14,12 @@ module AppleSystemStatus
14
14
  @session.driver.headers = { "User-Agent" => USER_AGENT }
15
15
  end
16
16
 
17
+ def quit!
18
+ @session.driver.quit if @session
19
+ end
20
+
17
21
  # crawl apple system status page
18
- # @param country [String] country code. (ex. jp, ca, fr. default. us)
22
+ # @param country [String] country code. (e.g. jp, ca, fr. default. us)
19
23
  # @param title [String] If specified, narrow the service title
20
24
  # @return [Hash]
21
25
  # @example response format
@@ -67,5 +71,24 @@ module AppleSystemStatus
67
71
  "https://www.apple.com/#{country}/support/systemstatus/"
68
72
  end
69
73
  end
74
+
75
+ # crawl apple system status page. When finished crawling, clear capybara session
76
+ # @param country [String] country code. (e.g. jp, ca, fr. default. us)
77
+ # @param title [String] If specified, narrow the service title
78
+ # @return [Hash]
79
+ # @example response format
80
+ # {
81
+ # title: ,
82
+ # services: [
83
+ # { title: , description: , status: }
84
+ # ]
85
+ # }
86
+ # @link https://github.com/teampoltergeist/poltergeist#memory-leak
87
+ def self.perform(country: nil, title: nil)
88
+ crawler = AppleSystemStatus::Crawler.new
89
+ crawler.perform(country: country, title: title)
90
+ ensure
91
+ crawler.quit!
92
+ end
70
93
  end
71
94
  end
@@ -1,3 +1,3 @@
1
1
  module AppleSystemStatus
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apple_system_status
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-05 00:00:00.000000000 Z
11
+ date: 2016-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -191,6 +191,7 @@ files:
191
191
  - ".rspec"
192
192
  - ".travis.yml"
193
193
  - ".yardopts"
194
+ - CHANGELOG.md
194
195
  - Gemfile
195
196
  - LICENSE.txt
196
197
  - README.md
@@ -224,9 +225,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
225
  version: '0'
225
226
  requirements: []
226
227
  rubyforge_project:
227
- rubygems_version: 2.4.5.1
228
+ rubygems_version: 2.5.1
228
229
  signing_key:
229
230
  specification_version: 4
230
231
  summary: Apple System Status scraping library
231
232
  test_files: []
232
- has_rdoc: