books_now 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/books_now.rb +22 -0
  3. metadata +86 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 127c3be985b03fdca5381377fe037f477b0f53e6f63995c7ede6810922286a51
4
+ data.tar.gz: 64b01013b04e5b473de91e5890f8d0be19044d31054efdd4c5bf4ef04244c227
5
+ SHA512:
6
+ metadata.gz: 1a2e84091f7f016b92f4490dd42e2cd8953149f37bbf861339aa374a814e24c25ffecae78b2bbf1276b802c6666741a9304ef877f8879eb91cac9ca109f39427
7
+ data.tar.gz: b4425136f08b4b710ae9e1c4fba1195239d95e75843e0536485a31833fc9efa1f09a05cc03c0d519d322f422388c6b3f7ab8ff8692f95be6fd408739d8d5ab78
@@ -0,0 +1,22 @@
1
+ require 'rest-client'
2
+ require 'json'
3
+ require 'csv'
4
+ module BooksNow
5
+ class Books
6
+ @book_response
7
+ attr_reader :book_response
8
+ def look_for(isbn)
9
+ @book_response = RestClient::Request.new(
10
+ :method => :get,
11
+ :url => 'https://openlibrary.org/api/books?bibkeys=ISBN:'+isbn,
12
+ :verify_ssl => false
13
+ ).execute
14
+ @book_response = @book_response.split('=')[1].split(';')[0]
15
+ @book_response = JSON.parse(@book_response)
16
+ return @book_response.to_s
17
+ end
18
+ def get_csv
19
+ CSV.open("books.csv", "wb") {|csv| @book_response.to_a.each {|token| csv << token} }
20
+ end
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: books_now
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Carlos Moreno
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-02-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: csv
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - lib/books_now.rb
62
+ homepage:
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubygems_version: 3.1.2
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: books_now retrieves books info, using it's ISBN. Shows an array representation
85
+ with JSON data for each finding
86
+ test_files: []