openstax_content 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5c44db02299099f4ac183c14f7f819c1e9a97718368e96d824098f52ac8c5b2
4
- data.tar.gz: 77609137d353ea7cb987e196c83b9b0b037ad2a3540cc390cfa61defcf05ded0
3
+ metadata.gz: 606de08c8e8a83ca196e43eef4d8159f4bddd9d94bf5a357af6e5e8109ed57ad
4
+ data.tar.gz: 4ef85c1b6bba83ef5a2605d76a8fc76fd3ce63dc80d84a3030a2f1943a56251d
5
5
  SHA512:
6
- metadata.gz: 55e497de225847314bce4a2a2b22a4956fd313b032bcce0a9e2ff72f9c405672c2ad6d8b1dd59273dd457f2be5a4fcdad76dd71fa7bb47dfbf80cf47fee133ff
7
- data.tar.gz: 7bcb8889c471a1d8748385367cd33438ffdb069da7c7e68c12d0a8109b4c8ab0c81c20f9f68716f1d0f650a49aee53f954c00b502f6e2b30e8fe5eb72777be30
6
+ metadata.gz: 6f994e45ad7f63e9d2ac8e2e143ef6b23a2688fee58c7de54a230cda84723bfa43eb1febeade0687e007d3453d1c970f7c4c6dad04cd75cee5ff0b9bc01003b2
7
+ data.tar.gz: 345ec56a1b9aecf201612f67ee3b283f22928afba02ec1ddeb2ad9f6e4243ab95f33049bb1f7892b570515538588c3a97859e4aa009f5f24038bf57fcf6aff0b
@@ -11,13 +11,20 @@ class OpenStax::Content::Archive
11
11
  @s3 ||= OpenStax::Content::S3.new
12
12
  end
13
13
 
14
+ def versions
15
+ @versions ||= s3.ls.reverse
16
+ end
17
+
14
18
  def version
15
- @version ||= s3.ls.last
19
+ @version || versions.first
20
+ end
21
+
22
+ def previous_version
23
+ versions[versions.index(version) + 1]
16
24
  end
17
25
 
18
26
  def base_url
19
- @base_url ||= "https://#{OpenStax::Content.domain}/#{
20
- OpenStax::Content.archive_path}/#{version}"
27
+ @base_url ||= "https://#{OpenStax::Content.domain}/#{OpenStax::Content.archive_path}/#{version}"
21
28
  end
22
29
 
23
30
  def url_for(object)
@@ -19,14 +19,14 @@ class OpenStax::Content::Book
19
19
  @url ||= archive.url_for "#{uuid}@#{version}"
20
20
  end
21
21
 
22
- def hash
23
- @hash ||= archive.json url
24
- end
25
-
26
22
  def url_fragment
27
23
  @url_fragment ||= url.chomp('.json')
28
24
  end
29
25
 
26
+ def hash
27
+ @hash ||= archive.json url
28
+ end
29
+
30
30
  def baked
31
31
  @baked ||= hash['baked']
32
32
  end
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Content
3
- VERSION = '1.1.0'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_content
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dante Soares
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-02 00:00:00.000000000 Z
11
+ date: 2022-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3