esa 1.1.0 → 1.1.1
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 +3 -0
- data/README.md +4 -3
- data/lib/esa/api_methods.rb +6 -1
- data/lib/esa/errors.rb +1 -0
- data/lib/esa/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bac52bf7b2e659e55596b89891f38c61773a52ac
|
4
|
+
data.tar.gz: 916c2ef77c5a18a5197992f38c2712cafc08395c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d17c30676abbdaabe4d381bec5d60a00bd5cabad134cf04f58af89ae5d32a98fb5c48234529bbd3420728f8bb067721c33466e5e96c29aaba3d4f827a690ae7e
|
7
|
+
data.tar.gz: 791b867661b6f9b4674d3073729b94f25b2756b43baeb6aa46350a4c60f0937d80a137e6f0323e93b44176e03d40348de21b5f50e6f2f26a1aa82224376498c5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 1.1.1 (2015-10-01)
|
2
|
+
- [Enable to set cookie for remote url on #upload_attachment by fukayatsu · Pull Request #14 · esaio/esa-ruby](https://github.com/esaio/esa-ruby/pull/14)
|
3
|
+
|
1
4
|
## 1.1.0 (2015-10-01)
|
2
5
|
- [Enable to Upload Attachment by fukayatsu · Pull Request #13 · esaio/esa-ruby](https://github.com/esaio/esa-ruby/pull/13)
|
3
6
|
|
data/README.md
CHANGED
@@ -76,9 +76,10 @@ client.delete_comment(comment_id)
|
|
76
76
|
|
77
77
|
|
78
78
|
# Upload Attachment(beta)
|
79
|
-
client.upload_attachment('/Users/foo/Desktop/foo.png')
|
80
|
-
client.upload_attachment(File.open('/Users/foo/Desktop/foo.png'))
|
81
|
-
client.upload_attachment('http://example.com/foo.png')
|
79
|
+
client.upload_attachment('/Users/foo/Desktop/foo.png') # Path
|
80
|
+
client.upload_attachment(File.open('/Users/foo/Desktop/foo.png')) # File
|
81
|
+
client.upload_attachment('http://example.com/foo.png') # Remote URL
|
82
|
+
client.upload_attachment(['http://example.com/foo.png', cookie_str]) # Remote URL + Cookie
|
82
83
|
|
83
84
|
```
|
84
85
|
|
data/lib/esa/api_methods.rb
CHANGED
@@ -101,11 +101,16 @@ module Esa
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def file_from(path_or_file_or_url)
|
104
|
+
path_or_file_or_url, cookie = *path_or_file_or_url if path_or_file_or_url.is_a?(Array)
|
105
|
+
|
104
106
|
if path_or_file_or_url.respond_to?(:read)
|
105
107
|
path_or_file_or_url
|
106
108
|
elsif path_or_file_or_url.is_a?(String) && HTTP_REGEX.match(path_or_file_or_url)
|
107
109
|
remote_url = path_or_file_or_url
|
108
|
-
|
110
|
+
headers = {}
|
111
|
+
headers[:Cookie] = cookie if cookie
|
112
|
+
response = send_simple_request(:get, remote_url, nil, headers)
|
113
|
+
raise RemoteURLNotAvailableError, "#{remote_url} is not available." unless response.status == 200
|
109
114
|
PathStringIO.new(File.basename(remote_url), response.body)
|
110
115
|
else
|
111
116
|
path = path_or_file_or_url
|
data/lib/esa/errors.rb
CHANGED
data/lib/esa/version.rb
CHANGED