timdex-ruby 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/lib/record.rb +42 -0
- data/lib/timdex.rb +20 -0
- data/lib/timdex/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f904ae3f7bc2b1be636038caa87c3dc88aef17a6fb06a8329c395445f28153b
|
4
|
+
data.tar.gz: c31b45ec99e56263f6bb27a36503c95e21268046eac091c7b77c05d48d3978f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea6eafb263545bd1e399dc514646a81830e2f6263337623fddf3e9ae37b4c2e1571526263a5cc9fe10efd9444a9243cfa458f6a86d74dc1b740823cf2dc7eda3
|
7
|
+
data.tar.gz: eef2b48e914ac865744eb9831cf4f96363487fe93dc2805c14f70956feb3369bf4110d0bd81eb1c19a62ff714f6eb25ca4d3313a2001a80f81b3db32b843c44c
|
data/.gitignore
CHANGED
data/lib/record.rb
CHANGED
@@ -42,4 +42,46 @@ class Record
|
|
42
42
|
def content_type
|
43
43
|
@record['content_type']
|
44
44
|
end
|
45
|
+
|
46
|
+
def content_format
|
47
|
+
@record['content_format']
|
48
|
+
end
|
49
|
+
|
50
|
+
def imprint
|
51
|
+
@record['imprint']
|
52
|
+
end
|
53
|
+
|
54
|
+
def isbns
|
55
|
+
@record['isbns']
|
56
|
+
end
|
57
|
+
|
58
|
+
def issns
|
59
|
+
@record['issns']
|
60
|
+
end
|
61
|
+
|
62
|
+
def oclcs
|
63
|
+
@record['oclcs']
|
64
|
+
end
|
65
|
+
|
66
|
+
def lccn
|
67
|
+
@record['lccn']
|
68
|
+
end
|
69
|
+
|
70
|
+
# full record only
|
71
|
+
|
72
|
+
def notes
|
73
|
+
@record['notes']
|
74
|
+
end
|
75
|
+
|
76
|
+
def physical_description
|
77
|
+
@record['physical_description']
|
78
|
+
end
|
79
|
+
|
80
|
+
def languages
|
81
|
+
@record['languages']
|
82
|
+
end
|
83
|
+
|
84
|
+
def place_of_publication
|
85
|
+
@record['place_of_publication']
|
86
|
+
end
|
45
87
|
end
|
data/lib/timdex.rb
CHANGED
@@ -43,6 +43,26 @@ module Timdex
|
|
43
43
|
parse_results(json_results, response.status)
|
44
44
|
end
|
45
45
|
|
46
|
+
def self.retrieve(id)
|
47
|
+
setup
|
48
|
+
auth unless validate_jwt
|
49
|
+
@conn.token_auth(@jwt)
|
50
|
+
response = @conn.get do |req|
|
51
|
+
req.url '/api/v1/record/' + id
|
52
|
+
req.headers['Authorization'] = "Bearer #{@jwt}"
|
53
|
+
end
|
54
|
+
json_result = JSON.parse(response.body)
|
55
|
+
parse_record(json_result, response.status)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.parse_record(json_result, status)
|
59
|
+
response = {}
|
60
|
+
response['status'] = status
|
61
|
+
response['record'] = Record.new(json_result)
|
62
|
+
response['raw'] = json_result
|
63
|
+
response
|
64
|
+
end
|
65
|
+
|
46
66
|
def self.parse_results(json_results, status)
|
47
67
|
results = {}
|
48
68
|
results['status'] = status
|
data/lib/timdex/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timdex-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Prevost
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: '0'
|
151
151
|
requirements: []
|
152
|
-
rubygems_version: 3.0.
|
152
|
+
rubygems_version: 3.0.3
|
153
153
|
signing_key:
|
154
154
|
specification_version: 4
|
155
155
|
summary: Ruby wrapper for MIT Libraries' TIMDEX Discovery API
|