mirror of
https://github.com/dkam/paapi.git
synced 2025-12-27 22:54:52 +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
|
## 0.0.8
|
||||||
- Fix a bug when accessing an empty name via Item
|
- Fix a bug when accessing an empty name via Item
|
||||||
|
|
||||||
|
|||||||
@@ -55,10 +55,8 @@ module Paapi
|
|||||||
end
|
end
|
||||||
|
|
||||||
def contributors_of(kind)
|
def contributors_of(kind)
|
||||||
contributors&.select { |e| e['Role'] == kind.to_s.gsub(/([[:alpha:]]+)/).each { |w| w.capitalize } }&.map do |e|
|
kind = kind.to_s.gsub(/([[:alpha:]]+)/) { |w| w.capitalize }
|
||||||
r = e['Name']
|
contributors.select { |e| e['Role'] == kind }&.map { |e| e.dig('Name') }&.reject {|n| n.to_s.empty?}
|
||||||
Nameable(r) unless r.to_s.empty?
|
|
||||||
end&.compact
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def actors
|
def actors
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
module Paapi
|
module Paapi
|
||||||
VERSION = '0.0.8'
|
VERSION = '0.1.0'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -33,5 +33,4 @@ Gem::Specification.new do |spec|
|
|||||||
|
|
||||||
spec.add_dependency 'http', '~> 4'
|
spec.add_dependency 'http', '~> 4'
|
||||||
spec.add_dependency 'aws-sigv4', '~> 1'
|
spec.add_dependency 'aws-sigv4', '~> 1'
|
||||||
spec.add_dependency 'nameable', '~> 1'
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -64,6 +64,19 @@ class ItemTest < Minitest::Test
|
|||||||
artists: []
|
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|
|
tc[:items].each_with_index do |item, idx|
|
||||||
item.keys.each do |exp|
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user