megalopolis 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.1.2
2
+ * NoDocumentErrorを定義
3
+
1
4
  ## 1.1.1
2
5
  * 1版のnextが最新版になる不具合を修正
3
6
 
@@ -1,6 +1,8 @@
1
1
  # coding: utf-8
2
2
 
3
3
  class Megalopolis
4
+ class NoDocumentError < StandardError; end
5
+
4
6
  class MHash < Hash
5
7
  def initialize(params={})
6
8
  self.update params
@@ -93,6 +95,7 @@ class Megalopolis
93
95
  def fetch_subject(base_url, log)
94
96
  page = send_req(File.join(base_url, "#{log}.json"))
95
97
  obj = JSON.parse(page)["entries"]
98
+ raise NoDocumentError, "Requested page is out of range" unless obj
96
99
 
97
100
  indexes = []
98
101
  obj.each do |index|
@@ -1,3 +1,3 @@
1
1
  class Megalopolis
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
@@ -25,7 +25,7 @@ describe Megalopolis, "が #get, :log => 100 を呼ぶ時は" do
25
25
  @s.next_page.class.should == Megalopolis::Subject
26
26
  end
27
27
 
28
- it "#prev_pageがMegalopolis::Subjectを返すこと" do
28
+ it "#next_pageの#prev_pageがMegalopolis::Subjectを返すこと" do
29
29
  @s.next_page.prev_page.class.should == Megalopolis::Subject
30
30
  end
31
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: megalopolis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-29 00:00:00.000000000 Z
12
+ date: 2012-12-05 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Megalopolis API wrapper for Ruby
15
15
  email:
@@ -47,7 +47,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
47
47
  version: '0'
48
48
  segments:
49
49
  - 0
50
- hash: -2746195983515821564
50
+ hash: -3035611038850066718
51
51
  required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  version: '0'
57
57
  segments:
58
58
  - 0
59
- hash: -2746195983515821564
59
+ hash: -3035611038850066718
60
60
  requirements: []
61
61
  rubyforge_project:
62
62
  rubygems_version: 1.8.24