megalopolis 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +3 -0
- data/lib/megalopolis/scheme.rb +3 -0
- data/lib/megalopolis/version.rb +1 -1
- data/spec/megalopolis_spec.rb +1 -1
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/lib/megalopolis/scheme.rb
CHANGED
@@ -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|
|
data/lib/megalopolis/version.rb
CHANGED
data/spec/megalopolis_spec.rb
CHANGED
@@ -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.
|
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-
|
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: -
|
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: -
|
59
|
+
hash: -3035611038850066718
|
60
60
|
requirements: []
|
61
61
|
rubyforge_project:
|
62
62
|
rubygems_version: 1.8.24
|