bonsai_client 0.2.1 → 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: d9668b5ab1fa6bb1942f0c385aa7134f6851dfb8
4
- data.tar.gz: 56e7ee83b952650f9a2e5def23c60f46297b0138
3
+ metadata.gz: d566744cb6bb9de5b78efdc49d01d34d7a810011
4
+ data.tar.gz: f8399219a8a70a160b52f87a0a3172350a675e36
5
5
  SHA512:
6
- metadata.gz: 99a0944c2083f5101e528ac631b6cbd34e5b8452cb90f7a988aa62d81d76a95071a1889403634f87dc467727d21b10dc1a523a3b3114ab061aed07a288b89d77
7
- data.tar.gz: 0aef701bcaf2aca75d3f87fdff55d978674ffe1da23941cea71fd221ae6ff5f52c2d2a6680e12ac7b21f66d3d143d23558a18372d57db2409c798e136b083c90
6
+ metadata.gz: cd243c02316ad8836f0cd09e80f0dada2bc65558cbb1e037906db524f02d007fc41acd23c02820bb1d24b3f467eeb1c6511449e607dfb7dcb34aabbc024e188a
7
+ data.tar.gz: 67ad3b51aabc61ce81fd85f31648f7c6193d196e2a38a3bf6ca7de6c8b3c89a6bfc9c8beaeb9ee2af415e53e0106ca6c4f2acb3a77e6b113e826abb1b69c1640
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.3.0] - 2019-05-26
6
+ * Add client secret.
7
+
5
8
  ## [0.2.1] - 2019-03-03
6
9
  * Fix bonsai_client command installation.
7
10
 
data/README.md CHANGED
@@ -30,7 +30,7 @@ rbenv rehash
30
30
  Upload a file:
31
31
 
32
32
  ```bash
33
- bonsai_client upload --url="http://bonsai-server.com" --path=/path/to/file --client-id=xxx
33
+ bonsai_client upload --url="http://xxx.yyy" --path=/path/to/file --client-id=zzz
34
34
  ```
35
35
 
36
36
  ## Usage in ruby code
@@ -40,7 +40,7 @@ bonsai_client upload --url="http://bonsai-server.com" --path=/path/to/file --cli
40
40
  require 'bonsai-client'
41
41
 
42
42
  # Create a new instance of Bonsai client:
43
- bonsai = BonsaiClient.new(url: 'http://bonsai-server.com')
43
+ bonsai = BonsaiClient.new(url: 'http://xxx.yyy', client_id: 'zzz')
44
44
 
45
45
  # Upload a file to a Bonsai server:
46
46
  response = bonsai.upload(path: '/path/to/my-file')
@@ -14,7 +14,6 @@ Gem::Specification.new do |s|
14
14
  s.description = %q{This gem is at an early stage of development. Please do not use it already.}
15
15
  s.licenses = ['MIT']
16
16
  s.homepage = 'https://gitlab.com/galfuslab/bonsai-client'
17
- all_files = `git ls-files -z`.split("\x0")
18
17
  s.files = %w(bonsai_client.gemspec) + Dir["*.md", "bin/*", "lib/**/*.rb"]
19
18
  s.executables = %w(bonsai_client)
20
19
  s.require_paths = %w(lib)
@@ -4,16 +4,18 @@ module BonsaiClient
4
4
 
5
5
  # @param [Hash] opts Otions to create the client.
6
6
  # @option opts [String] :url Bonsai server URL (such as https://bonsai-server.com)
7
- # @option opts [String] :client_id Unique ID for each client
7
+ # @option opts [String] :client_id Unique ID for each client.
8
+ # @option opts [String] :client_id Client secret.
8
9
  def initialize(opts = {})
9
10
  @url = opts[:url] || ''
10
11
  @client_id = opts[:client_id] || ''
12
+ @client_secret = opts[:client_secret] || ''
11
13
  end
12
14
 
13
15
  # Upload a file.
14
16
  #
15
17
  # @param [Hash] opts Otions to upload a file.
16
- # @option opts [String] :path File path
18
+ # @option opts [String] :path File path.
17
19
  #
18
20
  # @return [Hash] Response from Bonsai server.
19
21
  def upload(opts = {})
@@ -21,6 +23,7 @@ module BonsaiClient
21
23
  raise_no_file_path! if path.empty?
22
24
  response = RestClient.post(
23
25
  upload_url,
26
+ client_secret: @client_secret,
24
27
  file: File.new(path, 'rb')
25
28
  )
26
29
  JSON.parse(response.to_str, symbolize_names: true)
@@ -1,4 +1,4 @@
1
1
  module BonsaiClient
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  NAME = 'bonsai_client'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bonsai_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-03 00:00:00.000000000 Z
11
+ date: 2019-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -89,7 +89,6 @@ extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
91
  - CHANGELOG.md
92
- - NOTES.local.md
93
92
  - README.md
94
93
  - bin/bonsai_client
95
94
  - bin/console
data/NOTES.local.md DELETED
@@ -1,19 +0,0 @@
1
- # Notes (local)
2
-
3
- https://bonsai-dev.sm-editorial.net/
4
-
5
- /api/client/test/upload
6
-
7
- http://bonsai-dev.sm-editorial.net
8
-
9
- /api/thumbnail/checksum/4a20763f7203408c6c0c42d1ab47fd1bae754746
10
-
11
- file:
12
-
13
- bonsai_client upload --url=https://bonsai-dev.sm-editorial.net --path=test-data/sample.jpg --client-id=test
14
-
15
- ## Reunión
16
-
17
- - BonsaiClient
18
- - Repasar API
19
- - ¿Qué pasa cuando se envía un fichero dos veces?