alexmchale-gmail-client 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -2
- data/lib/gmail.rb +7 -9
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/gmail.rb
CHANGED
@@ -24,18 +24,15 @@ class GMail
|
|
24
24
|
self
|
25
25
|
end
|
26
26
|
|
27
|
-
def add_file(filename, content_type)
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
def add_jpeg(filename, data = nil)
|
32
|
-
name = File.basename filename
|
27
|
+
def add_file(filename, content_type, data = nil)
|
28
|
+
name = File.basename File.expand_path filename
|
33
29
|
data ||= File.read(filename)
|
34
|
-
|
35
|
-
|
36
|
-
add_data name, data, type
|
30
|
+
add_data name, data, content_type
|
37
31
|
end
|
38
32
|
|
33
|
+
def add_jpeg(filename, data = nil); add_file filename, 'image/jpeg', data; end
|
34
|
+
def add_png(filename, data = nil); add_file filename, 'image/png', data; end
|
35
|
+
|
39
36
|
def compose
|
40
37
|
boundary = rand(2**128).to_s(16)
|
41
38
|
|
@@ -45,6 +42,7 @@ class GMail
|
|
45
42
|
"Content-Type: #{attachment[:type]}; name=\"#{attachment[:name]}\"\r\n" +
|
46
43
|
"Content-Disposition: attachment; filename=\"#{attachment[:name]}\"\r\n" +
|
47
44
|
"Content-Transfer-Encoding: base64\r\n" +
|
45
|
+
"Content-ID: <#{attachment[:name]}>\r\n" +
|
48
46
|
"\r\n" +
|
49
47
|
Base64.encode64(attachment[:data])
|
50
48
|
end.compact.join
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alexmchale-gmail-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex McHale
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-11 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|