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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 703b6211a92ccabe31c718641e2cb15d79782614
4
- data.tar.gz: 8f10ed6f53c56d308aa0d028b78c4590b11007c7
3
+ metadata.gz: 78e84e4d9bb33e84d5830ed625262332b71aeb11
4
+ data.tar.gz: 14b6d402c7fdc66f2c1d4c2912f112f26fdcd0a1
5
5
  SHA512:
6
- metadata.gz: 4e24363fdc8a83fa956528471e6452d925cc67766f14d0f6b757f0221acb5ef8e9b5e35f45f89a0c373b1e834fcb7588a1bc1d8af3f7e09a00e60f08c3753820
7
- data.tar.gz: b9d5d00d7c16762cddefb3fb7830ee350ad9ef758367421b31947f7d69be22ea38b0d3191f640de81bb30f77e9e72da843b095d6e2de031d829f06bdda071756
6
+ metadata.gz: 2636c8c7ea2451cfcde19a482237522a481f1af933d425812ac7d82b99bdd8bbda6720bf7ab44166b56bbbe4b6b17feb58287de9076f0d47e27ace65e4d7ed76
7
+ data.tar.gz: 8630518537f2a847d5809ef5346e59e4c285e6ae875f2737ae1d2ff67a02d7ef847f33407abc1f4890477e0d120e05c363a1e8387825224cd5cd4fb116457a4f
@@ -24,5 +24,4 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.add_dependency "activesupport"
26
26
  spec.add_dependency "multipart-post"
27
- spec.add_dependency "mime-types", ">= 3.0"
28
27
  end
@@ -7,7 +7,7 @@ require "base64"
7
7
  require "json"
8
8
  require 'net/http/post/multipart'
9
9
  require 'apple-news/multipart_post_patch'
10
- require "mime/types"
10
+ require 'stringio'
11
11
 
12
12
  require "apple-news/version"
13
13
  require "apple-news/properties"
@@ -1,5 +1,3 @@
1
- require 'stringio'
2
-
3
1
  require 'apple-news/document/attachments'
4
2
  require 'apple-news/document/metadata'
5
3
  require 'apple-news/document/persistence'
@@ -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 ||= MIME::Types.type_for(filename)
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
@@ -1,3 +1,3 @@
1
1
  module AppleNews
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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: