nytimes_bestseller_api 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/nytimes_bestseller_api.rb +30 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b528716de9e82c61c908fa8eb1335f654a3703de04ea39f7f19485e78a9193e2
|
4
|
+
data.tar.gz: 1ee03c849f64a1af7c852f90bda48daa48632a926d28c9ac00b0e55ee9c9fb49
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c60f18757557f5b35fa9c8ba947645e87fd1465ae983ac9c87bdb62b902c6086aff509375ec69ea479274f4f4d627ba44a7b63ca4ed73dceec45086867837328
|
7
|
+
data.tar.gz: d609256cb05f1a23eade4119a056332e0d22dc12a7bca39b945ef8dc95794510a19d68bcb3726504dec816a6712812550c5927235efcad131c6ae537206c7418
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
class BestsellerAdapter
|
4
|
+
include HTTParty
|
5
|
+
|
6
|
+
base_uri 'https://api.nytimes.com/svc/books/v3/lists'
|
7
|
+
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@options = { query: { 'api-key': ENV["BESTSELLERS_API_KEY"]} }
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_bestseller_list
|
15
|
+
|
16
|
+
self.class.get('/current/hardcover-fiction.json', @options)
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
def parse_lists(bs_data)
|
21
|
+
|
22
|
+
results = []
|
23
|
+
bs_data['results']['books'].each do |bs|
|
24
|
+
results << Bestseller.create(rank: bs['rank'], title: bs['title'], author: bs['author'] )
|
25
|
+
end
|
26
|
+
results
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nytimes_bestseller_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eunkyoung
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-03-30 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: It helps to retreive up to date bestseller list using New York Times
|
14
|
+
API!
|
15
|
+
email: hope-kim@hotmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/nytimes_bestseller_api.rb
|
21
|
+
homepage:
|
22
|
+
licenses: []
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubygems_version: 3.0.3.1
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: retreive bestsller API
|
43
|
+
test_files: []
|