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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3278b259a881584b76f7a1c0a79fb57882318b5e
4
- data.tar.gz: 5bc05bdff8ba46b9d3b34b8e4aa19f86ecee44b4
3
+ metadata.gz: 6be60b6139599992af12269c393a0f33d68880ed
4
+ data.tar.gz: 6e006485acbade0f7d1080ff3e7d2d0a2c87dc02
5
5
  SHA512:
6
- metadata.gz: 6144050425ea7d09a01432fa6f4239353852eb9a8dcd79e8e4a362b79c6320c1c968aaf9b4d150c02753728ad0e332ad9d7aa84dc61c94a0c4556c939cd9f5bc
7
- data.tar.gz: 2d9493382efca14bdc15761a557f4a15096eb74e1674908869e4fcefe4313fc43cc75ec2fba5fca3029e54ccb5fe2e267b7505a80fe12957d7d9d3d4a3df91b2
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{ Easily use the API }
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
- 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
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
- houses = []
22
- house_array.each do |tenhouse|
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
- key = house_name.keys.first
32
- value = house_name.values.first
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
 
@@ -1,3 +1,3 @@
1
1
  module GOTWrapper
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.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: " Easily use the API "
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: []