apple-news 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 +4 -4
- data/apple-news.gemspec +0 -1
- data/lib/apple-news.rb +1 -1
- data/lib/apple-news/document.rb +0 -2
- data/lib/apple-news/document/attachments.rb +16 -1
- data/lib/apple-news/version.rb +1 -1
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78e84e4d9bb33e84d5830ed625262332b71aeb11
|
4
|
+
data.tar.gz: 14b6d402c7fdc66f2c1d4c2912f112f26fdcd0a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2636c8c7ea2451cfcde19a482237522a481f1af933d425812ac7d82b99bdd8bbda6720bf7ab44166b56bbbe4b6b17feb58287de9076f0d47e27ace65e4d7ed76
|
7
|
+
data.tar.gz: 8630518537f2a847d5809ef5346e59e4c285e6ae875f2737ae1d2ff67a02d7ef847f33407abc1f4890477e0d120e05c363a1e8387825224cd5cd4fb116457a4f
|
data/apple-news.gemspec
CHANGED
data/lib/apple-news.rb
CHANGED
data/lib/apple-news/document.rb
CHANGED
@@ -6,7 +6,7 @@ module AppleNews
|
|
6
6
|
included do
|
7
7
|
def add_file(file, mime = nil)
|
8
8
|
filename = Pathname.new(file).basename.to_s
|
9
|
-
mime ||=
|
9
|
+
mime ||= mime_for(filename)
|
10
10
|
|
11
11
|
@files[filename] = UploadIO.new(file, mime, filename)
|
12
12
|
end
|
@@ -18,6 +18,21 @@ module AppleNews
|
|
18
18
|
def add_string_as_file(name, contents, type)
|
19
19
|
@files[name] = UploadIO.new(StringIO.new(contents), type, name)
|
20
20
|
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
# I used to use the mime-types gem but apparently Rails uses version
|
25
|
+
# 1.x of the gem, which isn't even supported anymore. Since the Apple
|
26
|
+
# News API only allows a small handful of attachments, I'm okay with
|
27
|
+
# handling them myself.
|
28
|
+
def mime_for(filename)
|
29
|
+
case File.extname(filename).downcase
|
30
|
+
when ".jpg", ".jpeg" then "image/jpeg"
|
31
|
+
when ".png" then "image/png"
|
32
|
+
when ".gif" then "image/gif"
|
33
|
+
else "application/octet-stream"
|
34
|
+
end
|
35
|
+
end
|
21
36
|
end
|
22
37
|
end
|
23
38
|
end
|
data/lib/apple-news/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apple-news
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan LeFevre
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: mime-types
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '3.0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '3.0'
|
97
83
|
description: Fully-featured library for fetching and creating content with the Apple
|
98
84
|
News API.
|
99
85
|
email:
|