GOT_wrapper 0.2.0 → 0.3.0
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.
- checksums.yaml +4 -4
- data/GOT_wrapper.gemspec +1 -1
- data/README.md +8 -0
- data/lib/GOT_wrapper.rb +14 -16
- data/lib/GOT_wrapper/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6be60b6139599992af12269c393a0f33d68880ed
|
4
|
+
data.tar.gz: 6e006485acbade0f7d1080ff3e7d2d0a2c87dc02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3c9d2e5af053a3b4f9b12cfdd7c091652311f05ed9ca1cdeed2b9d0d98660ba88cee13a2ac4c30841aa9b04bf7aa9f046b9c63a6bf19e4b6f07dc1283ff4c0f
|
7
|
+
data.tar.gz: 2b7db5e4293461fefff00be1363b5bfbabf6f1db2b9a8b11dadef472f0cb5790a690905eeade47512ee576f7b61d69bd8974f1008f1f3d235826520f54ae9ba7
|
data/GOT_wrapper.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["xy2286@columbia.edu"]
|
11
11
|
|
12
12
|
spec.summary = %q{ A wrapper for A song of fire and ice}
|
13
|
-
spec.description = %q{
|
13
|
+
spec.description = %q{ Wrap data for you including houses, characters, books concerning Game of Thrones }
|
14
14
|
spec.homepage = "https://github.com/TomYang1993/GOT_wrapper.git"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
data/README.md
CHANGED
@@ -31,6 +31,14 @@ GOTWrapper::House.all
|
|
31
31
|
you will get a array of 400 houses, and you can call `.name` `.region` `.words` on your house element.
|
32
32
|
|
33
33
|
|
34
|
+
you can grab data of a single house by a `.find_by(house_name)` method:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
GOTWrapper::House.find_by("House Stark")
|
38
|
+
```
|
39
|
+
house_name must be both uppercase with a space inside
|
40
|
+
|
41
|
+
|
34
42
|
## Development
|
35
43
|
|
36
44
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/GOT_wrapper.rb
CHANGED
@@ -12,26 +12,24 @@ module GOTWrapper
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.all
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
house_array = []
|
16
|
+
i = 1
|
17
|
+
while i < 41
|
18
|
+
house_array << Unirest.get("http://www.anapioficeandfire.com/api/houses?page="+ i.to_s).body
|
19
|
+
i += 1
|
20
|
+
end
|
21
|
+
houses = []
|
22
|
+
house_array.each do |tenhouse|
|
23
|
+
tenhouse.each do |house|
|
24
|
+
houses << House.new(house)
|
20
25
|
end
|
21
|
-
|
22
|
-
|
23
|
-
tenhouse.each do |house|
|
24
|
-
houses << House.new(house)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
houses
|
26
|
+
end
|
27
|
+
houses
|
28
28
|
end
|
29
29
|
|
30
30
|
def self.find_by(house_name)
|
31
|
-
|
32
|
-
|
33
|
-
house = Unirest.get("http://www.anapioficeandfire.com/api/houses?#{key}=#{value}").body
|
34
|
-
House.new(house)
|
31
|
+
items = self.all
|
32
|
+
items.select{ |item| item.name.include? house_name }
|
35
33
|
end
|
36
34
|
|
37
35
|
|
data/lib/GOT_wrapper/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: GOT_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Yang
|
@@ -66,7 +66,8 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.1.2
|
69
|
-
description: "
|
69
|
+
description: " Wrap data for you including houses, characters, books concerning Game
|
70
|
+
of Thrones "
|
70
71
|
email:
|
71
72
|
- xy2286@columbia.edu
|
72
73
|
executables: []
|