ethon 0.6.3 → 0.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.
- data/.travis.yml +2 -2
- data/CHANGELOG.md +13 -3
- data/Gemfile +1 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/ethon.gemspec +0 -1
- data/lib/ethon.rb +4 -1
- data/lib/ethon/easy/queryable.rb +9 -2
- data/lib/ethon/version.rb +1 -1
- data/spec/ethon/easy/queryable_spec.rb +25 -1
- metadata +3 -19
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,14 +2,24 @@
|
|
2
2
|
|
3
3
|
## Master
|
4
4
|
|
5
|
-
|
5
|
+
Not backwards compatible changes:
|
6
|
+
|
7
|
+
* `mime-types` are no longer a dependency. The gem will be still used if available to determine the mime type of a file which is uploaded. That means you have to have take care of the gem installation yourself.
|
8
|
+
|
9
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.7.0...master)
|
10
|
+
|
11
|
+
## 0.7.0
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.6.3...v0.7.0)
|
14
|
+
|
15
|
+
## 0.6.3
|
16
|
+
|
17
|
+
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.6.2...v0.6.3)
|
6
18
|
|
7
19
|
## 0.6.2
|
8
20
|
|
9
21
|
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.6.1...v0.6.2)
|
10
22
|
|
11
|
-
The changelog entries are coming soon!
|
12
|
-
|
13
23
|
## 0.6.1
|
14
24
|
|
15
25
|
[Full Changelog](https://github.com/typhoeus/ethon/compare/v0.6.0...v0.6.1)
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -71,7 +71,7 @@ everything up correctly.
|
|
71
71
|
|
72
72
|
(The MIT License)
|
73
73
|
|
74
|
-
Copyright © 2012-
|
74
|
+
Copyright © 2012-2014 [Hans Hasselberg](http://www.hans.io)
|
75
75
|
|
76
76
|
Permission is hereby granted, free of charge, to any person obtaining a
|
77
77
|
copy of this software and associated documentation files (the "Software"),
|
data/ethon.gemspec
CHANGED
data/lib/ethon.rb
CHANGED
data/lib/ethon/easy/queryable.rb
CHANGED
@@ -75,16 +75,23 @@ module Ethon
|
|
75
75
|
# @return [ Array ] Array of informations.
|
76
76
|
def file_info(file)
|
77
77
|
filename = File.basename(file.path)
|
78
|
-
types = MIME::Types.type_for(filename)
|
79
78
|
[
|
80
79
|
filename,
|
81
|
-
|
80
|
+
mime_type(filename),
|
82
81
|
File.expand_path(file.path)
|
83
82
|
]
|
84
83
|
end
|
85
84
|
|
86
85
|
private
|
87
86
|
|
87
|
+
def mime_type(filename)
|
88
|
+
if defined?(MIME) && t = MIME::Types.type_for(filename).first
|
89
|
+
t.to_s
|
90
|
+
else
|
91
|
+
'application/octet-stream'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
88
95
|
def recursively_generate_pairs(h, prefix, pairs)
|
89
96
|
case h
|
90
97
|
when Hash
|
data/lib/ethon/version.rb
CHANGED
@@ -131,13 +131,37 @@ describe Ethon::Easy::Queryable do
|
|
131
131
|
end
|
132
132
|
|
133
133
|
context "when file" do
|
134
|
-
let(:file) {
|
134
|
+
let(:file) { File.open("spec/spec_helper.rb") }
|
135
135
|
let(:file_info) { params.method(:file_info).call(file) }
|
136
136
|
let(:hash) { {:a => {:b => [file]}} }
|
137
|
+
let(:mime_type) { file_info[1] }
|
137
138
|
|
138
139
|
it "transforms" do
|
139
140
|
expect(pairs).to eq([["a[b][0]", file_info]])
|
140
141
|
end
|
142
|
+
|
143
|
+
context "when MIME" do
|
144
|
+
context "when mime type" do
|
145
|
+
it "sets mime type to text" do
|
146
|
+
expect(mime_type).to eq("application/x-ruby")
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
context "when no mime type" do
|
151
|
+
let(:file) { Tempfile.new("fubar") }
|
152
|
+
|
153
|
+
it "sets mime type to default application/octet-stream" do
|
154
|
+
Object.send(:remove_const, :MIME)
|
155
|
+
expect(mime_type).to eq("application/octet-stream")
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context "when no MIME" do
|
161
|
+
it "sets mime type to default application/octet-stream" do
|
162
|
+
expect(mime_type).to eq("application/octet-stream")
|
163
|
+
end
|
164
|
+
end
|
141
165
|
end
|
142
166
|
end
|
143
167
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ethon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -27,22 +27,6 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 1.3.0
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: mime-types
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '1.18'
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '1.18'
|
46
30
|
description: Very lightweight libcurl wrapper.
|
47
31
|
email:
|
48
32
|
- me@hans.io
|
@@ -165,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
149
|
version: '0'
|
166
150
|
segments:
|
167
151
|
- 0
|
168
|
-
hash: -
|
152
|
+
hash: -1989061620893792868
|
169
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
154
|
none: false
|
171
155
|
requirements:
|