game_of_thrones_api 0.3.0 → 0.4.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: a183c141181b06da9971102948278966afc87107
4
- data.tar.gz: f71d6fb00c936bf1384c9dc9cf4f348b6107d3d1
3
+ metadata.gz: e35ef7f62a8e03e487fc3a0b08fc643411ca6174
4
+ data.tar.gz: 4b8512e1383f38cecde0eac6c3235467c592e45b
5
5
  SHA512:
6
- metadata.gz: 7009e890f25fc8619098ede5ad2212d541680db6d9d38bd33f7f25a75fca3d7f9942772e1a50f0da4fb82d1c916cf46adcfbbb14aa53b8dd92b2619d08be3ac6
7
- data.tar.gz: b7e9aee365b8195b9d60e563a62a15e2d1d6d074a7ff3f3e512fcf2e7c95132d836838d953bbe956baf5fa58efee03affffe4e39d60c0a96e329221fa6d5e6ab
6
+ metadata.gz: 90ff96e9407265de9666a4de70fefa40f0c9d6bbf8b9701a3148d489da683244429743cb5e57653a24bfd5ae2d60207d061c83de117a6cd81a55e31d4a62ac86
7
+ data.tar.gz: 6a3af14417c53252a0897fc3be6925def477b6764c1a157b6ee11f2f52b4b49512354d78eb7b17049e985cecbec753459a20d6602584ec18e8bf9d190d6f1f01
@@ -24,7 +24,7 @@ module GameOfThronesApi
24
24
  response = get("#{BASE_ENDPOINT}/books?page=1&pageSize=50")
25
25
  total_pages = get_page_count(response)
26
26
 
27
- get_all_records('books', response, total_pages)
27
+ get_all_records('books', response.parsed_response, total_pages)
28
28
  end
29
29
  end
30
30
 
@@ -40,7 +40,7 @@ module GameOfThronesApi
40
40
  response = get("#{BASE_ENDPOINT}/characters?page=1&pageSize=50")
41
41
  total_pages = get_page_count(response)
42
42
 
43
- get_all_records('characters', response, total_pages)
43
+ get_all_records('characters', response.parsed_response, total_pages)
44
44
  end
45
45
  end
46
46
 
@@ -56,7 +56,7 @@ module GameOfThronesApi
56
56
  response = get("#{BASE_ENDPOINT}/houses?page=1&pageSize=50")
57
57
  total_pages = get_page_count(response)
58
58
 
59
- get_all_records('houses', response, total_pages)
59
+ get_all_records('houses', response.parsed_response, total_pages)
60
60
  end
61
61
  end
62
62
 
@@ -89,7 +89,7 @@ module GameOfThronesApi
89
89
  def titleize_query(query)
90
90
  split_words =
91
91
  query.split.map.with_index do |word, index|
92
- if WORD_PARTICLES.exclude?(word) || index.zero?
92
+ if !WORD_PARTICLES.include?(word) || index.zero?
93
93
  word.capitalize
94
94
  else
95
95
  word
@@ -101,14 +101,13 @@ module GameOfThronesApi
101
101
 
102
102
  # The API results are paginated, just looping through the pages to collect
103
103
  # all the records associated with the category.
104
- def get_all_records(category, response, total_pages, page = 1)
105
- characters = response.parsed_response
106
-
107
- while total_pages >= page
108
- page += 1
109
- characters += get("#{BASE_ENDPOINT}/#{category}?page=#{page}&pageSize=50").parsed_response
104
+ def get_all_records(category, records, total_pages, page = 1)
105
+ if total_pages >= page
106
+ page += 1
107
+ records += get("#{BASE_ENDPOINT}/#{category}?page=#{page}&pageSize=50").parsed_response
108
+ get_all_records(category, records, total_pages, page)
109
+ else
110
+ records
110
111
  end
111
-
112
- characters
113
112
  end
114
113
  end
@@ -1,3 +1,3 @@
1
1
  module GameOfThronesApi
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: game_of_thrones_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Tam
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-07 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubyforge_project:
108
- rubygems_version: 2.5.1
108
+ rubygems_version: 2.6.8
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: Game of Thrones