/source.json: include raw api responses in output (#3940).
This commit is contained in:
@@ -55,12 +55,7 @@ class DeviantArtApiClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
body, code = HttpartyCache.get(url, **options)
|
body, code = HttpartyCache.get(url, **options)
|
||||||
|
JSON.parse(Zlib.gunzip(body), symbolize_names: true)
|
||||||
if code == 200
|
|
||||||
return JSON.parse(Zlib.gunzip(body), symbolize_names: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
raise "DeviantArtApiClient call failed (code=#{code}, url=#{url}, body=#{body})"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def oauth
|
def oauth
|
||||||
|
|||||||
@@ -224,6 +224,11 @@ module Sources
|
|||||||
end
|
end
|
||||||
memoize :related_posts
|
memoize :related_posts
|
||||||
|
|
||||||
|
# A hash containing the results of any API calls made by the strategy. For debugging purposes only.
|
||||||
|
def api_response
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
def to_h
|
def to_h
|
||||||
return {
|
return {
|
||||||
:artist_name => artist_name,
|
:artist_name => artist_name,
|
||||||
@@ -242,7 +247,8 @@ module Sources
|
|||||||
:description => artist_commentary_desc,
|
:description => artist_commentary_desc,
|
||||||
:dtext_title => dtext_artist_commentary_title,
|
:dtext_title => dtext_artist_commentary_title,
|
||||||
:dtext_description => dtext_artist_commentary_desc,
|
:dtext_description => dtext_artist_commentary_desc,
|
||||||
}
|
},
|
||||||
|
:api_response => api_response.to_h,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -286,6 +286,13 @@ module Sources
|
|||||||
end
|
end
|
||||||
memoize :api_download
|
memoize :api_download
|
||||||
|
|
||||||
|
def api_response
|
||||||
|
{
|
||||||
|
deviation: api_deviation,
|
||||||
|
metadata: api_metadata,
|
||||||
|
download: api_download,
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user