base-api-io 0.1.0 → 0.1.1

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: 93b0b1b6ea7a7180f59d6910a25cea3f5f1a7ca6b417d2e081c29350d9c80e4b
4
- data.tar.gz: a36ae63196190a583e604cd5c6bdd1276fe5a77282eb2fbc3c00693bffd36981
3
+ metadata.gz: 75e165c9fc644d01b252aa64ec930a1ed9ee8afd01508e63f4d05cedaf9fc799
4
+ data.tar.gz: e1584e9cff357d08dc13f6c70de359872e34a1fc31b5106555cd493b438261ec
5
5
  SHA512:
6
- metadata.gz: 9966cf37c70308251eae9bdccbc098f1a38f7a932510ffd0b9fdf9b89833bf1161164694e1109a5f6f97bf8e6479fb326b4677595d4da8e96275780e353e37da
7
- data.tar.gz: 5d9d85ed1bbbca40e653461dd2046e5b99bc7168272fce8f016ef5bf3f0120da9ebfd5b32f0b75b39f3b2d17cb380172493b453deb454ca0a9c05eb0c17ed778
6
+ metadata.gz: 191576a47dc3ea7f754986c06cbaba796a32d1960b114d4353b11067721b8cc756b9b812d53d76b8fcb0b23b13399b8eec54d6192d389198aabb2d087d8665e0
7
+ data.tar.gz: 8f38281bf3b0971c75d25a15185455639dfb633e705e5a2fa611bcb23119a59cfa17d7aa008eede4a14008fecc5955b153faecde084b9f95b67bb479d5b2c636
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- base-api-io (0.1.0)
4
+ base-api-io (0.1.1)
5
5
  faraday (~> 0.15.4)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Base
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/base-api-io.svg)](https://badge.fury.io/rb/base-api-io)
4
+
3
5
  Ruby client for the [Base API](https://www.base-api.io) service, with it you
4
6
  can manage authentication, email sending, files and images of your application.
5
7
 
@@ -34,6 +34,9 @@ module Base
34
34
  "#{url}/v1/#{path}/",
35
35
  headers: { 'Authorization' => "Bearer #{access_token}" }
36
36
  ) do |conn|
37
+ conn.request :multipart
38
+ conn.request :url_encoded
39
+
37
40
  conn.use RaiseError
38
41
  conn.use Faraday::Adapter::NetHttp
39
42
  end
@@ -11,10 +11,13 @@ module Base
11
11
  end
12
12
 
13
13
  # Uploads the given file and returns its metadata.
14
- def create(file:)
14
+ def create(path:, type:, filename:)
15
15
  request do
16
+ io =
17
+ Faraday::UploadIO.new(path, type, filename)
18
+
16
19
  response =
17
- connection.post('', 'file' => file)
20
+ connection.post('', 'file' => io)
18
21
 
19
22
  parse(response.body)
20
23
  end
@@ -14,10 +14,13 @@ module Base
14
14
  #
15
15
  # Only images with ImageMagick understands can be uploaded otherwise it
16
16
  # will raise an error.
17
- def create(image:)
17
+ def create(path:, type:, filename:)
18
18
  request do
19
+ io =
20
+ Faraday::UploadIO.new(path, type, filename)
21
+
19
22
  response =
20
- connection.post('', 'image' => image)
23
+ connection.post('', 'image' => io)
21
24
 
22
25
  parse(response.body)
23
26
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Base
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: base-api-io
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusztáv Szikszai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-16 00:00:00.000000000 Z
11
+ date: 2019-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday