carraway 1.1.0 → 1.2.0
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/CHANGELOG.md +7 -0
- data/lib/carraway/file.rb +4 -4
- data/lib/carraway/file_repository.rb +3 -0
- data/lib/carraway/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12f99c971b75174760a05ee0e8d78cdc8672034fd18c5dfc5d1bbf574e0098c3
|
4
|
+
data.tar.gz: 722f4a8bf0c11260e4c7f383dbd557d3fb18ab450ac2eee280bc93a8f3ddcf08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac61b3830a2b3c0896b392455d32812ba159ddd18ca07afe442e0ade928edbb312864e28052849f77ea4dd72ee9907e2a86d3445bb56e434f7d145e0eb511736
|
7
|
+
data.tar.gz: d476445edfbab2ade67c993e29a5d7f0a703db8696f1a75252af028e03416c37edea7212e37a60c1955eb79d95bb4f919b72d698cfbfbfd81a5c950a88c9f621
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.1.0](https://github.com/adorechic/carraway/tree/v1.1.0) (2019-02-28)
|
4
|
+
[Full Changelog](https://github.com/adorechic/carraway/compare/v1.0.1...v1.1.0)
|
5
|
+
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- Sort via created [\#13](https://github.com/adorechic/carraway/pull/13) ([isohi](https://github.com/isohi))
|
9
|
+
|
3
10
|
## [v1.0.1](https://github.com/adorechic/carraway/tree/v1.0.1) (2019-02-28)
|
4
11
|
[Full Changelog](https://github.com/adorechic/carraway/compare/v1.0.0...v1.0.1)
|
5
12
|
|
data/lib/carraway/file.rb
CHANGED
@@ -3,13 +3,14 @@ require 'aws-sdk-s3'
|
|
3
3
|
|
4
4
|
module Carraway
|
5
5
|
class File
|
6
|
-
attr_reader :uid, :created, :file, :published
|
6
|
+
attr_reader :uid, :ext, :created, :file, :published
|
7
7
|
attr_accessor :title, :labels, :category
|
8
8
|
|
9
|
-
def initialize(title:, file: nil, uid: nil, created: Time.now.to_i, labels: nil, published: nil, category: nil)
|
9
|
+
def initialize(title:, file: nil, uid: nil, ext: 'pdf', created: Time.now.to_i, labels: nil, published: nil, category: nil)
|
10
10
|
@title = title
|
11
11
|
@file = file
|
12
12
|
@uid = uid || generate_uid
|
13
|
+
@ext = file && file[:filename]&.split('.')&.last || ext
|
13
14
|
@created = created
|
14
15
|
@labels = labels
|
15
16
|
@published = published || created
|
@@ -24,9 +25,8 @@ module Carraway
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def path
|
27
|
-
ext = '.pdf' # FIXME Accept other type
|
28
28
|
# Seems prefix does not have to required parameter
|
29
|
-
[Config.file_backend['prefix'], '/', @uid, ext].join
|
29
|
+
[Config.file_backend['prefix'], '/', @uid, ".#{@ext}"].join
|
30
30
|
end
|
31
31
|
|
32
32
|
def to_h
|
@@ -12,6 +12,7 @@ module Carraway
|
|
12
12
|
client.scan(query).items.map do |item|
|
13
13
|
Carraway::File.new(
|
14
14
|
uid: item['uid'],
|
15
|
+
ext: item['ext'],
|
15
16
|
title: item['title'],
|
16
17
|
created: item['created'],
|
17
18
|
labels: item['labels'],
|
@@ -31,6 +32,7 @@ module Carraway
|
|
31
32
|
if item && item['record_type'] == 'file'
|
32
33
|
Carraway::File.new(
|
33
34
|
uid: item['uid'],
|
35
|
+
ext: item['ext'],
|
34
36
|
title: item['title'],
|
35
37
|
created: item['created'],
|
36
38
|
labels: item['labels'],
|
@@ -56,6 +58,7 @@ module Carraway
|
|
56
58
|
item: {
|
57
59
|
uid: file.uid,
|
58
60
|
record_type: 'file',
|
61
|
+
ext: file.ext,
|
59
62
|
title: file.title,
|
60
63
|
created: file.created || at.to_i,
|
61
64
|
labels: file.labels,
|
data/lib/carraway/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carraway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- adorechic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|