freefeed 0.5.1 → 0.5.2
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/lib/freefeed/v1/attachments.rb +6 -5
- data/lib/freefeed/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df70eb7a4e877e4fa7cf8693855850444e72f85a7409c5e74485c558c024522e
|
4
|
+
data.tar.gz: 4a3a8b81ae9fedb18f009e90ef2c8e75256ada5b306fe55efb3040329cb21b8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 945fda332433b9bc8037812d566b647ee64cf4d885158d967f7d648439114c18d026be4a09d9c3af60198df98058972e4fe3d02450f4ffa84341fe83ce64e886
|
7
|
+
data.tar.gz: 127f2016c0891cad053fd91a14611384e6d0805735a4abccfc56dc13af2bb460100a1ecaed6bd36c423a967ac6c2658450653fc920980e67223bebe30dc8f106
|
@@ -8,18 +8,19 @@ module Freefeed
|
|
8
8
|
module Attachments
|
9
9
|
# @param [String, Pathname, IO] source could by a file path
|
10
10
|
# or an IO object
|
11
|
-
def create_attachment(source)
|
12
|
-
options = { form: { file: file(source) } }
|
11
|
+
def create_attachment(source, content_type: nil)
|
12
|
+
options = { form: { file: file(source, content_type) } }
|
13
13
|
authenticated_request(:post, "/v1/attachments", options)
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
|
-
def file(source)
|
19
|
-
|
18
|
+
def file(source, content_type)
|
19
|
+
content_type ||= detect_content_type(source)
|
20
|
+
HTTP::FormData::File.new(source, content_type: content_type)
|
20
21
|
end
|
21
22
|
|
22
|
-
def
|
23
|
+
def detect_content_type(source)
|
23
24
|
return MimeMagic.by_magic(source) if source.is_a?(IO)
|
24
25
|
MimeMagic.by_path(source.to_s)
|
25
26
|
end
|
data/lib/freefeed/version.rb
CHANGED