mime_builder 0.0.4 → 0.1.0

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
- SHA1:
3
- metadata.gz: d8de3fc319dce616c0b945f1aa9f986618c6f363
4
- data.tar.gz: 1c1f37d3d4190ef49f741b8a6b9fa4348dcfa3d1
2
+ SHA256:
3
+ metadata.gz: c3bc85fb2a4fb507d444459978d274acd173ec68d1b0d3414878915fc9eba0b6
4
+ data.tar.gz: bc9cca5bd9c220ff653a426b7587cbb718f435c6d4ba6ceb46017bfad96c014b
5
5
  SHA512:
6
- metadata.gz: 885b5fb3c26a687f828b3257885c18c22225331df3c251c30274172dfe7a4c5adfa3e7e5df43bdaacc642c42d18207e928fa5b53a1b015332577527fd4d1054d
7
- data.tar.gz: 9ca88ad183f4fad5e3cee88567fe4d6d78f6b67ece89326780c54d43df54c1c5ece04a4093f86236e0b9115af6638749c6b75f07dbf684474d9b0e36c994addd
6
+ metadata.gz: f76bb1ef43d0a13ae765ba4afd3585c9d1f5535a5283731b1c5aa4cf409bdeec19e93a013053a4242def7aeb0b62e82b98a670d23db59377a955e2a232f31320
7
+ data.tar.gz: 03204521aeb3731e27c5a886fbd6c07115c4f27f957bc73446a379ea534ee264ae3d82b1d075c1c601d632ff9b238d37744fd0409843a16dc549c44d71bc147c
data/CHANGELOG.md CHANGED
@@ -1,8 +1,8 @@
1
1
  CHANGELOG
2
2
  ---------
3
- - **2015-12-14**: 0.0.4
3
+ - **2016-12-14**: 0.0.4
4
4
  - Add JSON support
5
- - **2015-05-30**: 0.0.3
5
+ - **2016-05-30**: 0.0.3
6
6
  - Add Text support for arbitrary content types
7
7
  - Add Text support for content disposition
8
8
  - **2016-01-25**: 0.0.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at johncwang@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,9 +1,3 @@
1
1
  source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2
2
 
3
- gem 'coveralls'
4
- gem 'mime'
5
- gem 'mime-types'
6
- gem 'mocha'
7
- gem 'rake'
8
- gem 'simplecov'
9
- gem 'test-unit'
3
+ gemspec
data/README.md CHANGED
@@ -2,11 +2,11 @@ MIMEBuilder Ruby
2
2
  ================
3
3
 
4
4
  [![Gem Version][gem-version-svg]][gem-version-link]
5
- [![Build Status][build-status-svg]][build-status-link]
5
+ [![Build Status][build-status-svg]][build-status-url]
6
6
  [![Coverage Status][coverage-status-svg]][coverage-status-link]
7
- [![Dependency Status][dependency-status-svg]][dependency-status-link]
8
7
  [![Code Climate][codeclimate-status-svg]][codeclimate-status-link]
9
8
  [![Scrutinizer Code Quality][scrutinizer-status-svg]][scrutinizer-status-link]
9
+
10
10
  [![Downloads][downloads-svg]][downloads-link]
11
11
  [![Docs][docs-rubydoc-svg]][docs-rubydoc-link]
12
12
  [![License][license-svg]][license-link]
@@ -107,7 +107,7 @@ Options:
107
107
 
108
108
  ```ruby
109
109
  builder = MIMEBuilder::JSON.new(
110
- 'Hi there!',
110
+ { foo: 'bar' },
111
111
  content_id_disable: true, # remove auto-generated Content-Id header
112
112
  base64_encode: false # disable default base64 encoding
113
113
  )
@@ -136,7 +136,7 @@ Please report these on [Github](https://github.com/grokify/mime-builder-ruby)
136
136
 
137
137
  ## License
138
138
 
139
- MIMEBuilder is available under an MIT-style license. See [LICENSE.txt](LICENSE.txt) for details.
139
+ MIMEBuilder is available under an MIT-style license. See [LICENSE.md](LICENSE.md) for details.
140
140
 
141
141
  MIMEBuilder © 2016 by John Wang
142
142
 
@@ -144,8 +144,10 @@ MIMEBuilder © 2016 by John Wang
144
144
  [gem-version-link]: http://badge.fury.io/rb/mime_builder
145
145
  [downloads-svg]: http://ruby-gem-downloads-badge.herokuapp.com/mime_builder
146
146
  [downloads-link]: https://rubygems.org/gems/mime_builder
147
- [build-status-svg]: https://api.travis-ci.org/grokify/mime-builder-ruby.svg?branch=master
148
- [build-status-link]: https://travis-ci.org/grokify/mime-builder-ruby
147
+ [build-status-svg]: https://github.com/grokify/mime-builder-ruby/workflows/ruby%20build/badge.svg?branch=master
148
+ [build-status-url]: https://github.com/grokify/mime-builder-ruby/actions
149
+ [codacy-svg]: https://api.codacy.com/project/badge/Grade/fa30d602e8ec4eae806bb43430989d65
150
+ [codacy-link]: https://www.codacy.com/app/grokify/mime-builder-ruby
149
151
  [coverage-status-svg]: https://coveralls.io/repos/grokify/mime-builder-ruby/badge.svg?branch=master
150
152
  [coverage-status-link]: https://coveralls.io/r/grokify/mime-builder-ruby?branch=master
151
153
  [dependency-status-svg]: https://gemnasium.com/grokify/mime-builder-ruby.svg
@@ -157,4 +159,4 @@ MIMEBuilder © 2016 by John Wang
157
159
  [docs-rubydoc-svg]: https://img.shields.io/badge/docs-rubydoc-blue.svg
158
160
  [docs-rubydoc-link]: http://www.rubydoc.info/gems/mime_builder/
159
161
  [license-svg]: https://img.shields.io/badge/license-MIT-blue.svg
160
- [license-link]: https://github.com/grokify/mime-builder-ruby/blob/master/LICENSE.txt
162
+ [license-link]: https://github.com/grokify/mime-builder-ruby/blob/master/LICENSE.md
@@ -65,9 +65,10 @@ module MIMEBuilder
65
65
 
66
66
  def get_attachment_content_disposition(filepath = nil)
67
67
  filename = File.basename(filepath.to_s)
68
- return filename.to_s.length > 0 \
69
- ? "attachment; filename=\"#{filename}\"" \
70
- : 'attachment'
68
+ if filename.to_s.length > 0
69
+ return "attachment; filename=\"#{filename}\""
70
+ end
71
+ 'attachment'
71
72
  end
72
73
  end
73
74
  end
@@ -33,9 +33,10 @@ module MIMEBuilder
33
33
  end
34
34
 
35
35
  def get_attachment_content_disposition(filename = nil)
36
- return filename.to_s.length > 0 \
37
- ? "attachment; filename=\"#{filename}\"" \
38
- : 'attachment'
36
+ if filename.to_s.length > 0
37
+ return "attachment; filename=\"#{filename}\""
38
+ end
39
+ 'attachment'
39
40
  end
40
41
  end
41
42
  end
data/lib/mime_builder.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module MIMEBuilder
2
- VERSION = '0.0.4'
2
+ VERSION = '0.1.0'
3
3
 
4
4
  autoload :Filepath, 'mime_builder/file'
5
5
  autoload :JSON, 'mime_builder/json'
data/test/test_file.rb CHANGED
@@ -1,11 +1,6 @@
1
1
  require './test/test_base.rb'
2
2
 
3
3
  class MIMEBuilderFileTest < Test::Unit::TestCase
4
-
5
- def test_file_one
6
- #assert_equal "bXlfYXBwX2tleTpteV9hcHBfc2VjcmV0", @rcsdk.send(:get_api_key)
7
- end
8
-
9
4
  def test_basic
10
5
  filepath = './test/test_file.pdf'
11
6
  filename = 'test_file.pdf'
data/test/test_json.rb CHANGED
@@ -1,12 +1,13 @@
1
1
  require './test/test_base.rb'
2
2
 
3
3
  require 'base64'
4
+ require 'multi_json'
4
5
 
5
6
  class MIMEBuilderJsonTest < Test::Unit::TestCase
6
7
  def test_base
7
8
  test_json = { hello: 'world' }
8
9
 
9
- json_part = MIMEBuilder::JSON.new(test_json)
10
+ json_part = MIMEBuilder::JSON.new test_json
10
11
 
11
12
  assert_equal 'application/json', json_part.mime.headers.get('Content-Type')
12
13
  assert_equal Base64.encode64(MultiJson.encode(test_json)), json_part.mime.body.to_s
@@ -15,10 +16,19 @@ class MIMEBuilderJsonTest < Test::Unit::TestCase
15
16
 
16
17
  def test_no_base64
17
18
  test_json = { hello: 'world' }
18
- test_json = MultiJson.encode(test_json)
19
+ test_json = MultiJson.encode test_json
19
20
 
20
21
  json_part = MIMEBuilder::JSON.new test_json, encode_base64: false
21
22
 
22
23
  assert_equal test_json, json_part.mime.body.to_s
23
24
  end
25
+
26
+ def test_base64_raw
27
+ info = { hello: 'world' }
28
+
29
+ builder = MIMEBuilder::JSON.new info, encode_base64: true
30
+
31
+ assert_equal 'eyJoZWxsbyI6IndvcmxkIn0='.encode('iso-8859-1'), builder.mime.body.to_s.strip
32
+ assert_equal true, builder.encode_base64?
33
+ end
24
34
  end
data/test/test_text.rb CHANGED
@@ -2,9 +2,9 @@ require './test/test_base.rb'
2
2
 
3
3
  class MIMEBuilderTextTest < Test::Unit::TestCase
4
4
  def test_contenttype
5
- test_text = 'Hello world!'
5
+ test_text = 'Hello world!'
6
6
 
7
- filepart = MIMEBuilder::Text.new(test_text)
7
+ filepart = MIMEBuilder::Text.new test_text
8
8
 
9
9
  assert_equal 'text/plain', filepart.mime.headers.get('Content-Type')
10
10
 
@@ -16,4 +16,4 @@ class MIMEBuilderTextTest < Test::Unit::TestCase
16
16
 
17
17
  assert_equal nil, filepart.mime.headers.get('Content-Id')
18
18
  end
19
- end
19
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mime_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Wang
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2021-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime
@@ -64,6 +64,76 @@ dependencies:
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: 1.12.1
67
+ - !ruby/object:Gem::Dependency
68
+ name: coveralls
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: mocha
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '1'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '1'
95
+ - !ruby/object:Gem::Dependency
96
+ name: rake
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '12'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '12'
109
+ - !ruby/object:Gem::Dependency
110
+ name: simplecov
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ - !ruby/object:Gem::Dependency
124
+ name: test-unit
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '3'
130
+ type: :development
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: '3'
67
137
  description: Helper library to build MIME parts
68
138
  email: johncwang@gmail.com
69
139
  executables: []
@@ -71,6 +141,7 @@ extensions: []
71
141
  extra_rdoc_files: []
72
142
  files:
73
143
  - CHANGELOG.md
144
+ - CODE_OF_CONDUCT.md
74
145
  - Gemfile
75
146
  - LICENSE.txt
76
147
  - README.md
@@ -84,11 +155,11 @@ files:
84
155
  - test/test_file.rb
85
156
  - test/test_json.rb
86
157
  - test/test_text.rb
87
- homepage: https://github.com/grokify/
158
+ homepage: https://github.com/grokify/mime-builder-ruby
88
159
  licenses:
89
160
  - MIT
90
161
  metadata: {}
91
- post_install_message:
162
+ post_install_message:
92
163
  rdoc_options: []
93
164
  require_paths:
94
165
  - lib
@@ -103,9 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
174
  - !ruby/object:Gem::Version
104
175
  version: '0'
105
176
  requirements: []
106
- rubyforge_project:
107
- rubygems_version: 2.6.7
108
- signing_key:
177
+ rubygems_version: 3.0.4
178
+ signing_key:
109
179
  specification_version: 4
110
180
  summary: MIME Builder is a helper to build MIME parts
111
181
  test_files: []