attache-api 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8931e55f0ecea4268085000b50136ef7b10fd0ac
4
- data.tar.gz: d4aa35b5cfb27dab0c89cfbdcef04863a0e8d853
3
+ metadata.gz: 45b92f794dde145cbafe72e3e79a25d04d214b87
4
+ data.tar.gz: e92db56d34dc75e6b1867a9431771ebd406be24e
5
5
  SHA512:
6
- metadata.gz: 9fd0d41f14b5dd23285b5b2e4e8ae05f16ce614f7cc581c6dc1a1d88130dc8c1972505e3899fb22e67f88fb34a22ab303b59a306eb99a3dc8c35f41bcb6a6c72
7
- data.tar.gz: 1971d934bffa4ad420271b82a75a14ffe404514a759e9fb5c7a762737260f98fac24ecbd8819fcf53b139bcc1d4c6ac95643c751cb3ac7451e4d3884f1d81c8a
6
+ metadata.gz: 268a7c6aa10b112c3c4293a3615beee065240ded1cebc2a1c83c713394ef62301fc4c948a17b52eaf4a14a8a8700ff873530e92b24bffbd5629c21347a629ebf
7
+ data.tar.gz: 864da926d65a4b53eb141ecfa0d582a34f911a2a0c760472e7506cf1577ec73c22880ad47c6cabeebec0969187e90f5e445671517a4a5d5d0139e5812e7fb942
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Attache/API
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/attache-api.svg)](https://badge.fury.io/rb/attache-api)
3
4
  [![Build Status](https://travis-ci.org/choonkeat/attache-api.svg?branch=master)](https://travis-ci.org/choonkeat/attache-api)
4
5
 
5
6
  Core library and tests to integrate with an [attache](https://github.com/choonkeat/attache) server; to be leveraged by client libraries e.g. [attache_rails](https://github.com/choonkeat/attache_rails) which integrates with ActiveRecord
@@ -38,6 +38,11 @@ module Attache
38
38
  rescue Exception
39
39
  raise if ENV['ATTACHE_DISCARD_FAILURE_RAISE_ERROR']
40
40
  end
41
+
42
+ def attaches_backup!(files)
43
+ files.reject! {|x| x.nil? || x == "" }
44
+ V1.attache_backup(*files.uniq) unless files.empty?
45
+ end
41
46
  end
42
47
  end
43
48
  end
@@ -13,6 +13,7 @@ module Attache
13
13
  ATTACHE_UPLOAD_URL = ENV.fetch('ATTACHE_UPLOAD_URL') { "#{ATTACHE_URL}/upload" }
14
14
  ATTACHE_DOWNLOAD_URL = ENV.fetch('ATTACHE_DOWNLOAD_URL') { "#{ATTACHE_URL}/view" }
15
15
  ATTACHE_DELETE_URL = ENV.fetch('ATTACHE_DELETE_URL') { "#{ATTACHE_URL}/delete" }
16
+ ATTACHE_BACKUP_URL = ENV.fetch('ATTACHE_BACKUP_URL') { "#{ATTACHE_URL}/backup" }
16
17
  ATTACHE_UPLOAD_DURATION = ENV.fetch('ATTACHE_UPLOAD_DURATION') { 3*3600 }.to_i # expires signed upload form
17
18
  ATTACHE_SECRET_KEY = ENV['ATTACHE_SECRET_KEY'] # unset to test password-less interaction
18
19
 
@@ -41,6 +42,13 @@ module Attache
41
42
  )
42
43
  end
43
44
 
45
+ def attache_backup(*paths)
46
+ HTTPClient.post_content(
47
+ URI.parse(ATTACHE_BACKUP_URL),
48
+ attache_auth_options.merge(paths: paths.join("\n"))
49
+ )
50
+ end
51
+
44
52
  def attache_auth_options
45
53
  if ATTACHE_SECRET_KEY
46
54
  uuid = SecureRandom.uuid
@@ -1,5 +1,5 @@
1
1
  module Attache
2
2
  module API
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attache-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - choonkeat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-08 00:00:00.000000000 Z
11
+ date: 2015-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient