alexmchale-gmail-client 0.0.1 → 0.1.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.
Files changed (3) hide show
  1. data/VERSION.yml +2 -2
  2. data/lib/gmail.rb +7 -9
  3. metadata +2 -2
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :minor: 0
2
+ :minor: 1
3
3
  :major: 0
4
- :patch: 1
4
+ :patch: 0
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
- add_data File.basename(File.expand_path(filename)), File.read(filename), content_type
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
- type = 'image/jpeg'
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.1
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-10 00:00:00 -07:00
12
+ date: 2009-03-11 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15