esa 3.5.0 → 3.7.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 +13 -3
- data/README.md +15 -1
- data/lib/esa/api_methods.rb +20 -1
- data/lib/esa/client.rb +16 -2
- data/lib/esa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31ac99673b27154dd0f51e26e9b2df21cc5ae9748836882d783fb20313844f60
|
|
4
|
+
data.tar.gz: ab2481808f8e74884def974efdcb432263917608e0e8effa6233eaff51eee09e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d3bb3fddea7149f744e344eaf9113a67cf3cbf2032dbfa9b14255657909bb3172431f9d100170e788f5744eb7593eb617b93661b73cf9791b2c85aaf3e217e0e
|
|
7
|
+
data.tar.gz: e03f488a818d740f1a303512ec5c9871372313e66c3a656354f98aa7962b3be942b6d5ec2a510356b983a1ae76103b0b6623e26d0c2990a76e4d95ac642bdeca
|
data/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
## Unreleased
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Nothing
|
|
4
|
+
|
|
5
|
+
## 3.7.0 (2026-08-04)
|
|
6
|
+
|
|
7
|
+
- add: [Add create_attachment instead of upload_attachment](https://github.com/esaio/esa-ruby/pull/102)
|
|
8
|
+
- **deprecated**: `#upload_attachment` has been deprecated. Use `#create_attachment` instead.
|
|
9
|
+
- ci: [CI: Use latest bundler for ruby-head](https://github.com/esaio/esa-ruby/pull/103)
|
|
10
|
+
|
|
11
|
+
## 3.6.0 (2026-06-17)
|
|
12
|
+
|
|
13
|
+
- add: [Add prepend_post API support](https://github.com/esaio/esa-ruby/pull/98)
|
|
4
14
|
|
|
5
15
|
## 3.5.0 (2026-02-18)
|
|
6
16
|
|
|
7
|
-
- [Tweak CI matrix](https://github.com/esaio/esa-ruby/pull/83)
|
|
17
|
+
- ci: [Tweak CI matrix](https://github.com/esaio/esa-ruby/pull/83)
|
|
8
18
|
- **changed**: Add support for Ruby 4.0 (formerly Ruby 3.5)
|
|
9
19
|
|
|
10
20
|
## 3.4.0 (2025-11-27)
|
|
11
21
|
|
|
12
|
-
- [Add ruby 3.5 and drop 3.1 from CI/required_ruby_version](https://github.com/esaio/esa-ruby/pull/77)
|
|
22
|
+
- ci: [Add ruby 3.5 and drop 3.1 from CI/required_ruby_version](https://github.com/esaio/esa-ruby/pull/77)
|
|
13
23
|
- **changed**: Drop support for Ruby 3.1
|
|
14
24
|
|
|
15
25
|
## 3.3.0 (2025-07-18)
|
data/README.md
CHANGED
|
@@ -87,6 +87,10 @@ client.update_post(post_number, name: 'bar')
|
|
|
87
87
|
client.append_post(post_number, content: 'bar')
|
|
88
88
|
#=> POST /v1/teams/foobar/posts/1/append
|
|
89
89
|
|
|
90
|
+
# (beta)
|
|
91
|
+
client.prepend_post(post_number, content: 'bar')
|
|
92
|
+
#=> POST /v1/teams/foobar/posts/1/prepend
|
|
93
|
+
|
|
90
94
|
client.delete_post(post_number)
|
|
91
95
|
#=> DELETE /v1/teams/foobar/posts/1
|
|
92
96
|
|
|
@@ -198,7 +202,17 @@ client.create_emoji(code: 'alias_code', origin_code: 'team_emoji')
|
|
|
198
202
|
client.delete_emoji('team_emoji')
|
|
199
203
|
#=> DELETE /v1/teams/foobar/emojis/team_emoji
|
|
200
204
|
|
|
201
|
-
# Upload Attachment
|
|
205
|
+
# Upload Attachment
|
|
206
|
+
client.create_attachment('/Users/foo/Desktop/foo.png') # Path
|
|
207
|
+
client.create_attachment(File.open('/Users/foo/Desktop/foo.png')) # File
|
|
208
|
+
client.create_attachment('http://example.com/foo.png') # Remote URL
|
|
209
|
+
client.create_attachment(['http://example.com/foo.png', cookie_str]) # Remote URL + Cookie
|
|
210
|
+
client.create_attachment(['http://example.com/foo.png', headers_hash]) # Remote URL + Headers
|
|
211
|
+
client.create_attachment('/Users/foo/Desktop/foo.png', name: 'bar.png') # Path + Name
|
|
212
|
+
#=> POST /v1/teams/foobar/attachments
|
|
213
|
+
#=> { "attachment" => { "url" => "https://img.esa.io/uploads/...", "name" => "foo.png", "size" => 12345, "content_type" => "image/png" } }
|
|
214
|
+
|
|
215
|
+
# Upload Attachment(beta): deprecated, use create_attachment instead
|
|
202
216
|
client.upload_attachment('/Users/foo/Desktop/foo.png') # Path
|
|
203
217
|
client.upload_attachment(File.open('/Users/foo/Desktop/foo.png')) # File
|
|
204
218
|
client.upload_attachment('http://example.com/foo.png') # Remote URL
|
data/lib/esa/api_methods.rb
CHANGED
|
@@ -53,6 +53,10 @@ module Esa
|
|
|
53
53
|
send_post("/v1/teams/#{current_team!}/posts/#{post_number}/append", wrap(params, :post), headers)
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
def prepend_post(post_number, params = nil, headers = nil)
|
|
57
|
+
send_post("/v1/teams/#{current_team!}/posts/#{post_number}/prepend", wrap(params, :post), headers)
|
|
58
|
+
end
|
|
59
|
+
|
|
56
60
|
def revisions(post_number, params = nil, headers = nil)
|
|
57
61
|
send_get("/v1/teams/#{current_team!}/posts/#{post_number}/revisions", params, headers)
|
|
58
62
|
end
|
|
@@ -192,8 +196,23 @@ module Esa
|
|
|
192
196
|
end
|
|
193
197
|
end
|
|
194
198
|
|
|
195
|
-
|
|
199
|
+
def create_attachment(path_or_file_or_url, params = {}, headers = nil)
|
|
200
|
+
file = file_from(path_or_file_or_url)
|
|
201
|
+
content_type = params.delete(:content_type) || content_type_from_file(file) || 'application/octet-stream'
|
|
202
|
+
|
|
203
|
+
form_data = { file: Faraday::FilePart.new(file, content_type) }
|
|
204
|
+
form_data[:name] = params[:name] if params[:name]
|
|
205
|
+
|
|
206
|
+
send_multipart_post("/v1/teams/#{current_team!}/attachments", form_data, headers)
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# deprecated: Use #create_attachment instead
|
|
196
210
|
def upload_attachment(path_or_file_or_url, params = {}, headers = nil)
|
|
211
|
+
unless @upload_attachment_deprecation_warned
|
|
212
|
+
warn '[DEPRECATION] `upload_attachment` is deprecated. Use `create_attachment` instead.'
|
|
213
|
+
@upload_attachment_deprecation_warned = true
|
|
214
|
+
end
|
|
215
|
+
|
|
197
216
|
file = file_from(path_or_file_or_url)
|
|
198
217
|
setup_params_for_upload(params, file)
|
|
199
218
|
|
data/lib/esa/client.rb
CHANGED
|
@@ -43,8 +43,12 @@ module Esa
|
|
|
43
43
|
send_request(:delete, path, params, headers)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
def
|
|
47
|
-
|
|
46
|
+
def send_multipart_post(path, params = nil, headers = nil)
|
|
47
|
+
send_request(:post, path, params, headers, connection: multipart_connection)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def send_request(method, path, params = nil, headers = nil, connection: esa_connection)
|
|
51
|
+
response = connection.send(method, path, params, headers)
|
|
48
52
|
raise TooManyRequestError if retry_on_rate_limit_exceeded && response.status == 429 # too_many_requests
|
|
49
53
|
Esa::Response.new(response)
|
|
50
54
|
rescue TooManyRequestError
|
|
@@ -71,6 +75,16 @@ module Esa
|
|
|
71
75
|
end
|
|
72
76
|
end
|
|
73
77
|
|
|
78
|
+
def multipart_connection
|
|
79
|
+
@multipart_connection ||= Faraday.new(faraday_options) do |c|
|
|
80
|
+
faraday_middlewares.each { |faraday_middleware| c.use faraday_middleware }
|
|
81
|
+
c.request :multipart
|
|
82
|
+
c.request :url_encoded
|
|
83
|
+
c.response :json
|
|
84
|
+
c.adapter Faraday.default_adapter
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
74
88
|
def s3_connection
|
|
75
89
|
@s3_connection ||= Faraday.new do |c|
|
|
76
90
|
faraday_middlewares.each { |faraday_middleware| c.use faraday_middleware }
|
data/lib/esa/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: esa
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- fukayatsu
|
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
201
201
|
- !ruby/object:Gem::Version
|
|
202
202
|
version: '0'
|
|
203
203
|
requirements: []
|
|
204
|
-
rubygems_version: 4.0.
|
|
204
|
+
rubygems_version: 4.0.16
|
|
205
205
|
specification_version: 4
|
|
206
206
|
summary: esa API v1 client library, written in Ruby
|
|
207
207
|
test_files: []
|