esa 3.0.0 → 3.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 +6 -0
- data/README.md +10 -1
- data/lib/esa/api_methods.rb +5 -0
- data/lib/esa/client.rb +6 -2
- data/lib/esa/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3089322959101e1af0cf6af4f0157da7a32c330a1e3932ba06e8186ba5bbf9c
|
4
|
+
data.tar.gz: 98999fb35d75f5b2e6d807db662c013b086eda587d215c20c93efe54fe577773
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b9471c0180ae168c740a3e925847e8c322e220d8b9fde86345b6aac4162a7b110ecbdcffd673dea89f28db8a3c3ea44f4fb9ff697ffdfca078608a827530c43
|
7
|
+
data.tar.gz: 4480d074b055194abc5d8ba033164ab734bd33e1afad5b2fbc400d8463f7a8aae96be774011b9495bd7dba9870d12b8231fa36386da4cbc71a5d8267da128879
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
nothing
|
4
4
|
|
5
|
+
## 3.2.0 (2025-07-08)
|
6
|
+
- add: [Support `faraday_middlewares` option in Esa::Client](https://github.com/esaio/esa-ruby/pull/71)
|
7
|
+
|
8
|
+
## 3.1.0 (2025-02-21)
|
9
|
+
- add: [Add signed_urls method](https://github.com/esaio/esa-ruby/pull/70)
|
10
|
+
|
5
11
|
## 3.0.0 (2025-02-20)
|
6
12
|
- :warning: breaking: [Drop Support for Ruby < 3.1](https://github.com/esaio/esa-ruby/pull/67)
|
7
13
|
- ci: [Tweak CI ruby versions](https://github.com/esaio/esa-ruby/pull/65)
|
data/README.md
CHANGED
@@ -26,6 +26,9 @@ Or install it yourself as:
|
|
26
26
|
# Initialization
|
27
27
|
client = Esa::Client.new(access_token: "<access_token>", current_team: 'foo')
|
28
28
|
|
29
|
+
# Initialization with faraday_middlewares
|
30
|
+
# client = Esa::Client.new(access_token: "<access_token>", current_team: 'foo', faraday_middlewares: [Faraday::Response::Logger])
|
31
|
+
|
29
32
|
# Authenticated User API
|
30
33
|
client.user
|
31
34
|
#=> GET /v1/user
|
@@ -192,9 +195,15 @@ client.upload_attachment('http://example.com/foo.png') # Remote
|
|
192
195
|
client.upload_attachment(['http://example.com/foo.png', cookie_str]) # Remote URL + Cookie
|
193
196
|
client.upload_attachment(['http://example.com/foo.png', headers_hash]) # Remote URL + Headers
|
194
197
|
|
195
|
-
# Signed url for secure upload(beta)
|
198
|
+
# Signed url for secure upload(beta): deprecated
|
196
199
|
client.signed_url('uploads/p/attachments/1/2016/08/16/1/foobar.png')
|
197
200
|
#=> GET /v1/teams/foobar/signed_url/uploads/p/attachments/1/2016/08/16/1/foobar.png
|
201
|
+
|
202
|
+
# Signed urls for secure upload(beta): upto 1,000 urls at once
|
203
|
+
client.signed_urls(['https://files.esa.io/.../1', 'https://files.esa.io/.../2']) # expires_in defaults to 60 seconds and can be set from 1 to 604800
|
204
|
+
client.signed_urls(['https://files.esa.io/.../1', 'https://files.esa.io/.../2'], expires_in: 3600) # expires_in: 1 hour
|
205
|
+
#=> POST /v1/teams/foobar/signed_urls
|
206
|
+
#=> { signed_urls: [['https://files.esa.io/.../1', 'https://singed_url1'], ['https://files.esa.io/.../2', 'https://singed_url2']] }
|
198
207
|
```
|
199
208
|
|
200
209
|
|
data/lib/esa/api_methods.rb
CHANGED
@@ -202,6 +202,11 @@ module Esa
|
|
202
202
|
send_get("/v1/teams/#{current_team!}/signed_url/#{file_path}", params, headers)
|
203
203
|
end
|
204
204
|
|
205
|
+
def signed_urls(file_urls, params = {}, headers = nil)
|
206
|
+
params = params.merge(urls: file_urls)
|
207
|
+
send_post("/v1/teams/#{current_team!}/signed_urls", params, headers)
|
208
|
+
end
|
209
|
+
|
205
210
|
private
|
206
211
|
|
207
212
|
def wrap(params, envelope)
|
data/lib/esa/client.rb
CHANGED
@@ -8,14 +8,15 @@ module Esa
|
|
8
8
|
|
9
9
|
include ApiMethods
|
10
10
|
|
11
|
-
def initialize(access_token: nil, api_endpoint: nil, current_team: nil, default_headers: {}, retry_on_rate_limit_exceeded: true)
|
11
|
+
def initialize(access_token: nil, api_endpoint: nil, current_team: nil, default_headers: {}, retry_on_rate_limit_exceeded: true, faraday_middlewares: [])
|
12
12
|
@access_token = access_token
|
13
13
|
@api_endpoint = api_endpoint
|
14
14
|
@current_team = current_team
|
15
15
|
@default_headers = default_headers
|
16
16
|
@retry_on_rate_limit_exceeded = retry_on_rate_limit_exceeded
|
17
|
+
@faraday_middlewares = faraday_middlewares
|
17
18
|
end
|
18
|
-
attr_accessor :current_team, :default_headers, :retry_on_rate_limit_exceeded
|
19
|
+
attr_accessor :current_team, :default_headers, :retry_on_rate_limit_exceeded, :faraday_middlewares
|
19
20
|
|
20
21
|
def current_team!
|
21
22
|
raise TeamNotSpecifiedError, "current_team is not specified" unless @current_team
|
@@ -63,6 +64,7 @@ module Esa
|
|
63
64
|
|
64
65
|
def esa_connection
|
65
66
|
@esa_connection ||= Faraday.new(faraday_options) do |c|
|
67
|
+
faraday_middlewares.each { |faraday_middleware| c.use faraday_middleware }
|
66
68
|
c.request :json
|
67
69
|
c.response :json
|
68
70
|
c.adapter Faraday.default_adapter
|
@@ -71,6 +73,7 @@ module Esa
|
|
71
73
|
|
72
74
|
def s3_connection
|
73
75
|
@s3_connection ||= Faraday.new do |c|
|
76
|
+
faraday_middlewares.each { |faraday_middleware| c.use faraday_middleware }
|
74
77
|
c.request :multipart
|
75
78
|
c.request :url_encoded
|
76
79
|
c.response :xml
|
@@ -80,6 +83,7 @@ module Esa
|
|
80
83
|
|
81
84
|
def simple_connection
|
82
85
|
@simple_connection ||= Faraday.new do |c|
|
86
|
+
faraday_middlewares.each { |faraday_middleware| c.use faraday_middleware }
|
83
87
|
c.adapter Faraday.default_adapter
|
84
88
|
end
|
85
89
|
end
|
data/lib/esa/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fukayatsu
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: base64
|
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
217
|
- !ruby/object:Gem::Version
|
218
218
|
version: '0'
|
219
219
|
requirements: []
|
220
|
-
rubygems_version: 3.6.
|
220
|
+
rubygems_version: 3.6.7
|
221
221
|
specification_version: 4
|
222
222
|
summary: esa API v1 client library, written in Ruby
|
223
223
|
test_files: []
|