mirror of
https://github.com/dkam/paapi.git
synced 2025-12-28 07:04:53 +00:00
Remove Nameable dependancy and return API data directly
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
## 0.1.0
|
||||
- Remove Nameable dependancy and return the data as the API returns it.
|
||||
|
||||
## 0.0.9
|
||||
- Fix bug with no contributors in response
|
||||
|
||||
## 0.0.8
|
||||
- Fix a bug when accessing an empty name via Item
|
||||
|
||||
|
||||
@@ -55,10 +55,8 @@ module Paapi
|
||||
end
|
||||
|
||||
def contributors_of(kind)
|
||||
contributors&.select { |e| e['Role'] == kind.to_s.gsub(/([[:alpha:]]+)/).each { |w| w.capitalize } }&.map do |e|
|
||||
r = e['Name']
|
||||
Nameable(r) unless r.to_s.empty?
|
||||
end&.compact
|
||||
kind = kind.to_s.gsub(/([[:alpha:]]+)/) { |w| w.capitalize }
|
||||
contributors.select { |e| e['Role'] == kind }&.map { |e| e.dig('Name') }&.reject {|n| n.to_s.empty?}
|
||||
end
|
||||
|
||||
def actors
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Paapi
|
||||
VERSION = '0.0.8'
|
||||
VERSION = '0.1.0'
|
||||
end
|
||||
|
||||
@@ -33,5 +33,4 @@ Gem::Specification.new do |spec|
|
||||
|
||||
spec.add_dependency 'http', '~> 4'
|
||||
spec.add_dependency 'aws-sigv4', '~> 1'
|
||||
spec.add_dependency 'nameable', '~> 1'
|
||||
end
|
||||
|
||||
@@ -64,6 +64,19 @@ class ItemTest < Minitest::Test
|
||||
artists: []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Bad Contributors',
|
||||
response: 'get_item_bad_contributor.json',
|
||||
item_count: 1,
|
||||
items: [
|
||||
{
|
||||
asin: "055357342X",
|
||||
authors: ['.'],
|
||||
illustrators: [],
|
||||
artists: []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -77,7 +90,7 @@ class ItemTest < Minitest::Test
|
||||
|
||||
tc[:items].each_with_index do |item, idx|
|
||||
item.keys.each do |exp|
|
||||
assert_equal item[exp], resp.items[idx].send(exp)
|
||||
assert_equal item[exp], resp.items[idx].send(exp), "Dataset: #{tc[:name]}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user