carraway 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: 632adb2f6ff495cf9291c9061d9022f7f0d757d9fd04eedec59ac0c3a5c88114
4
- data.tar.gz: 3769286c48060006b6a9e069cd879b83dc431f2d23e4c893cf50d9a1ce571caa
3
+ metadata.gz: 12f99c971b75174760a05ee0e8d78cdc8672034fd18c5dfc5d1bbf574e0098c3
4
+ data.tar.gz: 722f4a8bf0c11260e4c7f383dbd557d3fb18ab450ac2eee280bc93a8f3ddcf08
5
5
  SHA512:
6
- metadata.gz: fd7678b5f12149c84cc1a42d4987f2e909ea06a32ebe987d9931c2f997a2e1141cf0f44a80ed60946c3816c457f576d484ae67e0b87ee55543629dcac464817c
7
- data.tar.gz: 2e221d04a2b6d34affe891fe6a8a19074b3f798751306b54d28c967e6cad3818908d1302116af40602d938f60870618642a77a3c6ac75870b762b952cfe02530
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,
@@ -1,3 +1,3 @@
1
1
  module Carraway
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
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.1.0
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-02-28 00:00:00.000000000 Z
11
+ date: 2019-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor