kinetic_sdk 5.0.27 → 5.0.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +24 -0
- data/gems/mime-types-3.6.0/Code-of-Conduct.md +128 -0
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/History.md +18 -0
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/README.rdoc +2 -1
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/Rakefile +1 -0
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/type.rb +68 -43
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/container.rb +2 -2
- data/gems/mime-types-3.6.0/lib/mime/types/deprecations.rb +56 -0
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/loader.rb +1 -1
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/registry.rb +6 -4
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/test_mime_type.rb +37 -33
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/test_mime_types.rb +11 -16
- data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/test_mime_types_class.rb +3 -3
- data/gems/{mime-types-data-3.2024.0305/History.md → mime-types-data-3.2025.0107/CHANGELOG.md} +242 -180
- data/gems/mime-types-data-3.2025.0107/CODE_OF_CONDUCT.md +128 -0
- data/gems/{mime-types-data-3.2024.0305/Contributing.md → mime-types-data-3.2025.0107/CONTRIBUTING.md} +39 -133
- data/gems/mime-types-data-3.2025.0107/CONTRIBUTORS.md +52 -0
- data/gems/{mime-types-data-3.2024.0305/Licence.md → mime-types-data-3.2025.0107/LICENCE.md} +1 -1
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/Manifest.txt +6 -17
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/README.md +30 -30
- data/gems/mime-types-data-3.2025.0107/Rakefile +88 -0
- data/gems/mime-types-data-3.2025.0107/SECURITY.md +7 -0
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/content_type_mime.db +4 -3
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/ext_mime.db +4 -3
- data/gems/mime-types-data-3.2025.0107/data/mime-types.json +1 -0
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.content_type.column +71 -5
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.docs.column +66 -0
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.encoding.column +66 -0
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.flags.column +70 -4
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.friendly.column +66 -0
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.pext.column +66 -0
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.use_instead.column +69 -3
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/data/mime.xrefs.column +132 -66
- data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/lib/mime/types/data.rb +1 -1
- data/lib/kinetic_sdk/core/lib/jwt.rb +1 -1
- data/lib/kinetic_sdk/core/lib/space.rb +17 -8
- data/lib/kinetic_sdk/integrator/integrator-sdk.rb +140 -0
- data/lib/kinetic_sdk/integrator/lib/connections.rb +82 -0
- data/lib/kinetic_sdk/integrator/lib/metadata.rb +31 -0
- data/lib/kinetic_sdk/integrator/lib/operations.rb +102 -0
- data/lib/kinetic_sdk/utils/kinetic-http.rb +20 -20
- data/lib/kinetic_sdk/version.rb +1 -1
- data/lib/kinetic_sdk.rb +3 -2
- metadata +59 -66
- data/gems/mime-types-3.5.2/Code-of-Conduct.md +0 -73
- data/gems/mime-types-3.5.2/lib/mime/types/deprecations.rb +0 -36
- data/gems/mime-types-data-3.2024.0305/Code-of-Conduct.md +0 -75
- data/gems/mime-types-data-3.2024.0305/Rakefile +0 -170
- data/gems/mime-types-data-3.2024.0305/data/mime-types.json +0 -1
- data/gems/mime-types-data-3.2024.0305/types/application.yaml +0 -18611
- data/gems/mime-types-data-3.2024.0305/types/audio.yaml +0 -1740
- data/gems/mime-types-data-3.2024.0305/types/chemical.yaml +0 -71
- data/gems/mime-types-data-3.2024.0305/types/conference.yaml +0 -9
- data/gems/mime-types-data-3.2024.0305/types/drawing.yaml +0 -15
- data/gems/mime-types-data-3.2024.0305/types/font.yaml +0 -65
- data/gems/mime-types-data-3.2024.0305/types/image.yaml +0 -1316
- data/gems/mime-types-data-3.2024.0305/types/message.yaml +0 -241
- data/gems/mime-types-data-3.2024.0305/types/model.yaml +0 -450
- data/gems/mime-types-data-3.2024.0305/types/multipart.yaml +0 -179
- data/gems/mime-types-data-3.2024.0305/types/text.yaml +0 -1257
- data/gems/mime-types-data-3.2024.0305/types/video.yaml +0 -1156
- data/gems/mime-types-data-3.2024.0305/types/world.yaml +0 -8
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/Contributing.md +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/Licence.md +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/Manifest.txt +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/type/columnar.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/_columnar.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/cache.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/columnar.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/full.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types/logger.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime/types.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/lib/mime-types.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/bad-fixtures/malformed +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/fixture/json.json +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/fixture/old-data +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/fixture/yaml.yaml +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/minitest_helper.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/test_mime_types_cache.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/test_mime_types_lazy.rb +0 -0
- /data/gems/{mime-types-3.5.2 → mime-types-3.6.0}/test/test_mime_types_loader.rb +0 -0
- /data/gems/{mime-types-data-3.2024.0305 → mime-types-data-3.2025.0107}/lib/mime-types-data.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af8ae8e567ca02d56419f62d5d065cc75cd3371dbd7ef3ca80d497f5eae076c8
|
4
|
+
data.tar.gz: 83ef665a09075f3d43ad5e28099a5125f83ed32256c7fab651dd69ae1ef44bd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 144a1d3677376488ca3b2a626a11643186eff94d6fc14699e566ffb575e077b209fe6e0ba3136879f2c7d112f06935f11479f14e67e20df275c4df065fcb354c
|
7
|
+
data.tar.gz: e83d3a855d3d457f5fb6b2b86c6e5a0b1b52b6ff2252ce24b31fbfa367d449ebd20c29cc3092727c25296dab3efe43b1cad6d47feff897f45adfeb3294040084
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [5.0.29](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.29) (2025-01-11)
|
4
|
+
|
5
|
+
**Implemented enhancements:**
|
6
|
+
|
7
|
+
- Fix integrator sdk methods for executing and inspecting operations.
|
8
|
+
- Fix integrator sdk methods for testing connections.
|
9
|
+
|
10
|
+
## [5.0.28](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.28) (2025-01-10)
|
11
|
+
|
12
|
+
**Implemented enhancements:**
|
13
|
+
|
14
|
+
- Add the Integrator SDK for managing connections and operations.
|
15
|
+
- Updated mime-types gem to 3.6.0
|
16
|
+
- Updated mime-types-data gem to 3.2025.0107
|
17
|
+
|
3
18
|
## [5.0.27](https://github.com/kineticdata/kinetic-sdk-rb/tree/5.0.27) (2024-06-26)
|
4
19
|
|
5
20
|
**Implemented enhancements:**
|
data/README.md
CHANGED
@@ -15,6 +15,7 @@ The following Kinetic Data applications are supported in this SDK library:
|
|
15
15
|
* Kinetic Bridgehub 1.0+
|
16
16
|
* Kinetic Discussions 1.0+
|
17
17
|
* Kinetic Filehub 1.0+
|
18
|
+
* Kinetic Integrator 0.1.0+
|
18
19
|
* Kinetic Task 4.0+
|
19
20
|
|
20
21
|
## Getting Started
|
@@ -141,6 +142,29 @@ puts response.content # Ruby Hash
|
|
141
142
|
puts response.content_string # JSON formatted response body
|
142
143
|
```
|
143
144
|
|
145
|
+
### Kinetic Integrator SDK example
|
146
|
+
|
147
|
+
```ruby
|
148
|
+
integrator_sdk = KineticSdk::Integrator.new({
|
149
|
+
space_server_url: "https://my-space.domain",
|
150
|
+
space_slug: "my-space",
|
151
|
+
username: "space-user",
|
152
|
+
password: "space-user-password",
|
153
|
+
options: {
|
154
|
+
log_level: "info",
|
155
|
+
oauth_client_id: "integration-user",
|
156
|
+
oauth_client_secret: "integration-user-password"
|
157
|
+
}
|
158
|
+
})
|
159
|
+
response = integrator_sdk.find_connections()
|
160
|
+
connections = response.content
|
161
|
+
|
162
|
+
puts response.code # String value of HTTP response code ("200", "400", "500", etc...)
|
163
|
+
puts response.status # Ruby Fixnum value of response.code (200, 400, 500, etc...)
|
164
|
+
puts response.content # Ruby Hash
|
165
|
+
puts response.content_string # JSON formatted response body
|
166
|
+
```
|
167
|
+
|
144
168
|
### Kinetic Task SDK example
|
145
169
|
|
146
170
|
```ruby
|
@@ -0,0 +1,128 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
10
|
+
identity and orientation.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
14
|
+
|
15
|
+
## Our Standards
|
16
|
+
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
- Demonstrating empathy and kindness toward other people
|
21
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
- Giving and gracefully accepting constructive feedback
|
23
|
+
- Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
- Focusing on what is best not just for us as individuals, but for the overall
|
26
|
+
community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
- The use of sexualized language or imagery, and sexual attention or advances of
|
31
|
+
any kind
|
32
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
- Public or private harassment
|
34
|
+
- Publishing others' private information, such as a physical or email address,
|
35
|
+
without their explicit permission
|
36
|
+
- Other conduct which could reasonably be considered inappropriate in a
|
37
|
+
professional setting
|
38
|
+
|
39
|
+
## Enforcement Responsibilities
|
40
|
+
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
45
|
+
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
50
|
+
|
51
|
+
## Scope
|
52
|
+
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official email address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
58
|
+
|
59
|
+
## Enforcement
|
60
|
+
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
reported to the community leaders responsible for enforcement at [INSERT CONTACT
|
63
|
+
METHOD]. All complaints will be reviewed and investigated promptly and fairly.
|
64
|
+
|
65
|
+
All community leaders are obligated to respect the privacy and security of the
|
66
|
+
reporter of any incident.
|
67
|
+
|
68
|
+
## Enforcement Guidelines
|
69
|
+
|
70
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
71
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
72
|
+
|
73
|
+
### 1. Correction
|
74
|
+
|
75
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
76
|
+
unprofessional or unwelcome in the community.
|
77
|
+
|
78
|
+
**Consequence**: A private, written warning from community leaders, providing
|
79
|
+
clarity around the nature of the violation and an explanation of why the
|
80
|
+
behavior was inappropriate. A public apology may be requested.
|
81
|
+
|
82
|
+
### 2. Warning
|
83
|
+
|
84
|
+
**Community Impact**: A violation through a single incident or series of
|
85
|
+
actions.
|
86
|
+
|
87
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
88
|
+
interaction with the people involved, including unsolicited interaction with
|
89
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
90
|
+
includes avoiding interactions in community spaces as well as external channels
|
91
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
92
|
+
ban.
|
93
|
+
|
94
|
+
### 3. Temporary Ban
|
95
|
+
|
96
|
+
**Community Impact**: A serious violation of community standards, including
|
97
|
+
sustained inappropriate behavior.
|
98
|
+
|
99
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
100
|
+
communication with the community for a specified period of time. No public or
|
101
|
+
private interaction with the people involved, including unsolicited interaction
|
102
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
103
|
+
Violating these terms may lead to a permanent ban.
|
104
|
+
|
105
|
+
### 4. Permanent Ban
|
106
|
+
|
107
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
108
|
+
standards, including sustained inappropriate behavior, harassment of an
|
109
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
110
|
+
|
111
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
112
|
+
community.
|
113
|
+
|
114
|
+
## Attribution
|
115
|
+
|
116
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
117
|
+
version 2.1, available at
|
118
|
+
<https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.
|
119
|
+
|
120
|
+
Community Impact Guidelines were inspired by
|
121
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
122
|
+
|
123
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
124
|
+
<https://www.contributor-covenant.org/faq>. Translations are available at
|
125
|
+
<https://www.contributor-covenant.org/translations>.
|
126
|
+
|
127
|
+
[homepage]: https://www.contributor-covenant.org
|
128
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
@@ -1,5 +1,23 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.6.0 / 2024-10-02
|
4
|
+
|
5
|
+
- 2 deprecations:
|
6
|
+
|
7
|
+
- Array-based MIME::Type initialization
|
8
|
+
- String-based MIME::Type initialization
|
9
|
+
|
10
|
+
Use of these these will result in deprecation warnings.
|
11
|
+
|
12
|
+
- Added `logger` to the gemspec to suppress a bundled gem warning with Ruby
|
13
|
+
3.3.5. This warning should not be showing up until Ruby 3.4.0 is released and
|
14
|
+
will be suppressed in Ruby 3.3.6.
|
15
|
+
|
16
|
+
- Reworked the deprecation message code to be somewhat more flexible and allow
|
17
|
+
for outputting certain warnings once. Because there will be at least one other
|
18
|
+
release after 3.6, we do not need to make the type initialization deprecations
|
19
|
+
frequent with this release.
|
20
|
+
|
3
21
|
## 3.5.2 / 2024-01-02
|
4
22
|
|
5
23
|
There are no primary code changes, but we are releasing this as an update as
|
@@ -183,7 +183,8 @@ MAJOR.MINOR:
|
|
183
183
|
MAJOR.MINOR.PATCH.
|
184
184
|
|
185
185
|
In practical terms, there will be fewer releases of mime-types focussing on
|
186
|
-
features because of the existence of the
|
186
|
+
features because of the existence of the
|
187
|
+
{mime-types-data}[https://github.com/mime-types/mime-types-data] gem, and if
|
187
188
|
features are marked deprecated in the course of mime-types 3.x, they will not
|
188
189
|
be removed until mime-types 4.x or possibly later.
|
189
190
|
|
@@ -22,6 +22,7 @@ spec = Hoe.spec "mime-types" do
|
|
22
22
|
spec_extras[:metadata] = ->(val) { val["rubygems_mfa_required"] = "true" }
|
23
23
|
|
24
24
|
extra_deps << ["mime-types-data", "~> 3.2015"]
|
25
|
+
extra_deps << ["logger", ">= 0"]
|
25
26
|
|
26
27
|
extra_dev_deps << ["hoe", ">= 3.0", "< 5"]
|
27
28
|
extra_dev_deps << ["hoe-doofus", "~> 1.0"]
|
@@ -4,20 +4,22 @@
|
|
4
4
|
module MIME
|
5
5
|
end
|
6
6
|
|
7
|
+
require "mime/types/deprecations"
|
8
|
+
|
7
9
|
# The definition of one MIME content-type.
|
8
10
|
#
|
9
11
|
# == Usage
|
10
|
-
# require
|
12
|
+
# require "mime/types"
|
11
13
|
#
|
12
|
-
# plaintext = MIME::Types[
|
14
|
+
# plaintext = MIME::Types["text/plain"] # => [ text/plain ]
|
13
15
|
# text = plaintext.first
|
14
|
-
# puts text.media_type # =>
|
15
|
-
# puts text.sub_type # =>
|
16
|
+
# puts text.media_type # => "text"
|
17
|
+
# puts text.sub_type # => "plain"
|
16
18
|
#
|
17
|
-
# puts text.extensions.join(
|
18
|
-
# puts text.preferred_extension # =>
|
19
|
-
# puts text.friendly # =>
|
20
|
-
# puts text.i18n_key # =>
|
19
|
+
# puts text.extensions.join(" ") # => "txt asc c cc h hh cpp hpp dat hlp"
|
20
|
+
# puts text.preferred_extension # => "txt"
|
21
|
+
# puts text.friendly # => "Text Document"
|
22
|
+
# puts text.i18n_key # => "text.plain"
|
21
23
|
#
|
22
24
|
# puts text.encoding # => quoted-printable
|
23
25
|
# puts text.default_encoding # => quoted-printable
|
@@ -28,45 +30,45 @@ end
|
|
28
30
|
# puts text.provisional? # => false
|
29
31
|
# puts text.complete? # => true
|
30
32
|
#
|
31
|
-
# puts text # =>
|
33
|
+
# puts text # => "text/plain"
|
32
34
|
#
|
33
|
-
# puts text ==
|
34
|
-
# puts
|
35
|
-
# puts text ==
|
36
|
-
# puts
|
35
|
+
# puts text == "text/plain" # => true
|
36
|
+
# puts "text/plain" == text # => true
|
37
|
+
# puts text == "text/x-plain" # => false
|
38
|
+
# puts "text/x-plain" == text # => false
|
37
39
|
#
|
38
|
-
# puts MIME::Type.simplified(
|
39
|
-
# puts MIME::Type.i18n_key(
|
40
|
+
# puts MIME::Type.simplified("x-appl/x-zip") # => "x-appl/x-zip"
|
41
|
+
# puts MIME::Type.i18n_key("x-appl/x-zip") # => "x-appl.x-zip"
|
40
42
|
#
|
41
|
-
# puts text.like?(
|
42
|
-
# puts text.like?(MIME::Type.new(
|
43
|
+
# puts text.like?("text/x-plain") # => true
|
44
|
+
# puts text.like?(MIME::Type.new("content-type" => "x-text/x-plain")) # => true
|
43
45
|
#
|
44
46
|
# puts text.xrefs.inspect # => { "rfc" => [ "rfc2046", "rfc3676", "rfc5147" ] }
|
45
47
|
# puts text.xref_urls # => [ "http://www.iana.org/go/rfc2046",
|
46
48
|
# # "http://www.iana.org/go/rfc3676",
|
47
49
|
# # "http://www.iana.org/go/rfc5147" ]
|
48
50
|
#
|
49
|
-
# xtext = MIME::Type.new(
|
50
|
-
# puts xtext.media_type # =>
|
51
|
-
# puts xtext.raw_media_type # =>
|
52
|
-
# puts xtext.sub_type # =>
|
53
|
-
# puts xtext.raw_sub_type # =>
|
51
|
+
# xtext = MIME::Type.new("x-text/x-plain")
|
52
|
+
# puts xtext.media_type # => "text"
|
53
|
+
# puts xtext.raw_media_type # => "x-text"
|
54
|
+
# puts xtext.sub_type # => "plain"
|
55
|
+
# puts xtext.raw_sub_type # => "x-plain"
|
54
56
|
# puts xtext.complete? # => false
|
55
57
|
#
|
56
|
-
# puts MIME::Types.any? { |type| type.content_type ==
|
58
|
+
# puts MIME::Types.any? { |type| type.content_type == "text/plain" } # => true
|
57
59
|
# puts MIME::Types.all?(&:registered?) # => false
|
58
60
|
#
|
59
61
|
# # Various string representations of MIME types
|
60
|
-
# qcelp = MIME::Types[
|
61
|
-
# puts qcelp.content_type # =>
|
62
|
-
# puts qcelp.simplified # =>
|
62
|
+
# qcelp = MIME::Types["audio/QCELP"].first # => audio/QCELP
|
63
|
+
# puts qcelp.content_type # => "audio/QCELP"
|
64
|
+
# puts qcelp.simplified # => "audio/qcelp"
|
63
65
|
#
|
64
|
-
# xwingz = MIME::Types[
|
65
|
-
# puts xwingz.content_type # =>
|
66
|
-
# puts xwingz.simplified # =>
|
66
|
+
# xwingz = MIME::Types["application/x-Wingz"].first # => application/x-Wingz
|
67
|
+
# puts xwingz.content_type # => "application/x-Wingz"
|
68
|
+
# puts xwingz.simplified # => "application/x-wingz"
|
67
69
|
class MIME::Type
|
68
70
|
# Reflects a MIME content-type specification that is not correctly
|
69
|
-
# formatted (it
|
71
|
+
# formatted (it is not +type+/+subtype+).
|
70
72
|
class InvalidContentType < ArgumentError
|
71
73
|
# :stopdoc:
|
72
74
|
def initialize(type_string)
|
@@ -93,14 +95,20 @@ class MIME::Type
|
|
93
95
|
end
|
94
96
|
|
95
97
|
# The released version of the mime-types library.
|
96
|
-
VERSION = "3.
|
98
|
+
VERSION = "3.6.0"
|
97
99
|
|
98
100
|
include Comparable
|
99
101
|
|
100
102
|
# :stopdoc:
|
101
|
-
#
|
102
|
-
#
|
103
|
-
|
103
|
+
# Full conformance with RFC 6838 §4.2 (the recommendation for < 64 characters is not
|
104
|
+
# enforced or reported because MIME::Types mostly deals with registered data). RFC 4288
|
105
|
+
# §4.2 does not restrict the first character to alphanumeric, but the total length of
|
106
|
+
# each part is limited to 127 characters. RFCC 2045 §5.1 does not restrict the character
|
107
|
+
# composition except for whitespace, but MIME::Type was always more strict than this.
|
108
|
+
restricted_name_first = "[0-9a-zA-Z]"
|
109
|
+
restricted_name_chars = "[-!#{$&}^_.+0-9a-zA-Z]{0,126}"
|
110
|
+
restricted_name = "#{restricted_name_first}#{restricted_name_chars}"
|
111
|
+
MEDIA_TYPE_RE = %r{(#{restricted_name})/(#{restricted_name})}.freeze
|
104
112
|
I18N_RE = /[^[:alnum:]]/.freeze
|
105
113
|
BINARY_ENCODINGS = %w[base64 8bit].freeze
|
106
114
|
ASCII_ENCODINGS = %w[7bit quoted-printable].freeze
|
@@ -110,12 +118,15 @@ class MIME::Type
|
|
110
118
|
:ASCII_ENCODINGS
|
111
119
|
|
112
120
|
# Builds a MIME::Type object from the +content_type+, a MIME Content Type
|
113
|
-
# value (e.g.,
|
121
|
+
# value (e.g., "text/plain" or "application/x-eruby"). The constructed object
|
114
122
|
# is yielded to an optional block for additional configuration, such as
|
115
123
|
# associating extensions and encoding information.
|
116
124
|
#
|
117
125
|
# * When provided a Hash or a MIME::Type, the MIME::Type will be
|
118
126
|
# constructed with #init_with.
|
127
|
+
#
|
128
|
+
# There are two deprecated initialization forms:
|
129
|
+
#
|
119
130
|
# * When provided an Array, the MIME::Type will be constructed using
|
120
131
|
# the first element as the content type and the remaining flattened
|
121
132
|
# elements as extensions.
|
@@ -132,11 +143,23 @@ class MIME::Type
|
|
132
143
|
when Hash
|
133
144
|
init_with(content_type)
|
134
145
|
when Array
|
146
|
+
MIME::Types.deprecated(
|
147
|
+
class: MIME::Type,
|
148
|
+
method: :new,
|
149
|
+
pre: "when called with an Array",
|
150
|
+
once: true
|
151
|
+
)
|
135
152
|
self.content_type = content_type.shift
|
136
153
|
self.extensions = content_type.flatten
|
137
154
|
when MIME::Type
|
138
155
|
init_with(content_type.to_h)
|
139
156
|
else
|
157
|
+
MIME::Types.deprecated(
|
158
|
+
class: MIME::Type,
|
159
|
+
method: :new,
|
160
|
+
pre: "when called with a String",
|
161
|
+
once: true
|
162
|
+
)
|
140
163
|
self.content_type = content_type
|
141
164
|
end
|
142
165
|
|
@@ -181,7 +204,7 @@ class MIME::Type
|
|
181
204
|
# comparisons involved are:
|
182
205
|
#
|
183
206
|
# 1. self.simplified <=> other.simplified (ensures that we
|
184
|
-
#
|
207
|
+
# do not try to compare different types)
|
185
208
|
# 2. IANA-registered definitions < other definitions.
|
186
209
|
# 3. Complete definitions < incomplete definitions.
|
187
210
|
# 4. Current definitions < obsolete definitions.
|
@@ -243,7 +266,7 @@ class MIME::Type
|
|
243
266
|
# +a.simplified+.
|
244
267
|
#
|
245
268
|
# Presumably, if <code>a.simplified <=> b.simplified</code> is +0+, then
|
246
|
-
# +a.simplified+ has the same hash as +b.simplified+. So we assume it
|
269
|
+
# +a.simplified+ has the same hash as +b.simplified+. So we assume it is
|
247
270
|
# suitable for #hash to delegate to #simplified in service of the #eql?
|
248
271
|
# invariant.
|
249
272
|
def hash
|
@@ -319,7 +342,7 @@ class MIME::Type
|
|
319
342
|
# exceptions defined, the first extension will be used.
|
320
343
|
#
|
321
344
|
# When setting #preferred_extensions, if #extensions does not contain this
|
322
|
-
# extension, this will be added to #
|
345
|
+
# extension, this will be added to #extensions.
|
323
346
|
#
|
324
347
|
# :attr_accessor: preferred_extension
|
325
348
|
|
@@ -330,7 +353,9 @@ class MIME::Type
|
|
330
353
|
|
331
354
|
##
|
332
355
|
def preferred_extension=(value) # :nodoc:
|
333
|
-
|
356
|
+
if value
|
357
|
+
add_extensions(value)
|
358
|
+
end
|
334
359
|
@preferred_extension = value
|
335
360
|
end
|
336
361
|
|
@@ -343,7 +368,7 @@ class MIME::Type
|
|
343
368
|
# provided is invalid.
|
344
369
|
#
|
345
370
|
# If the encoding is not provided on construction, this will be either
|
346
|
-
#
|
371
|
+
# "quoted-printable" (for text/* media types) and "base64" for eveything
|
347
372
|
# else.
|
348
373
|
#
|
349
374
|
# :attr_accessor: encoding
|
@@ -393,7 +418,7 @@ class MIME::Type
|
|
393
418
|
#
|
394
419
|
# call-seq:
|
395
420
|
# text_plain.friendly # => "Text File"
|
396
|
-
# text_plain.friendly(
|
421
|
+
# text_plain.friendly("en") # => "Text File"
|
397
422
|
def friendly(lang = "en")
|
398
423
|
@friendly ||= {}
|
399
424
|
|
@@ -486,7 +511,7 @@ class MIME::Type
|
|
486
511
|
# Returns the MIME::Type as a string for implicit conversions. This allows
|
487
512
|
# MIME::Type objects to appear on either side of a comparison.
|
488
513
|
#
|
489
|
-
#
|
514
|
+
# "text/plain" == MIME::Type.new("content-type" => "text/plain")
|
490
515
|
def to_str
|
491
516
|
content_type
|
492
517
|
end
|
@@ -627,7 +652,7 @@ class MIME::Type
|
|
627
652
|
-string
|
628
653
|
end
|
629
654
|
else
|
630
|
-
# MRI 2.2 and older
|
655
|
+
# MRI 2.2 and older do not have a method for string interning,
|
631
656
|
# so we simply freeze them for keeping a similar interface
|
632
657
|
def intern_string(string)
|
633
658
|
string.freeze
|
@@ -5,10 +5,10 @@ require "forwardable"
|
|
5
5
|
|
6
6
|
# MIME::Types requires a serializable keyed container that returns an empty Set
|
7
7
|
# on a key miss. Hash#default_value cannot be used because, while it traverses
|
8
|
-
# the Marshal format correctly, it
|
8
|
+
# the Marshal format correctly, it will not survive any other serialization
|
9
9
|
# format (plus, a default of a mutable object resuls in a shared mess).
|
10
10
|
# Hash#default_proc cannot be used without a wrapper because it prevents
|
11
|
-
# Marshal serialization (and
|
11
|
+
# Marshal serialization (and does not survive the round-trip).
|
12
12
|
class MIME::Types::Container # :nodoc:
|
13
13
|
extend Forwardable
|
14
14
|
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "mime/types/logger"
|
4
|
+
|
5
|
+
class << MIME::Types
|
6
|
+
# Used to mark a method as deprecated in the mime-types interface.
|
7
|
+
def deprecated(options = {}, &block) # :nodoc:
|
8
|
+
message =
|
9
|
+
if options[:message]
|
10
|
+
options[:message]
|
11
|
+
else
|
12
|
+
klass = options.fetch(:class)
|
13
|
+
|
14
|
+
msep = case klass
|
15
|
+
when Class, Module
|
16
|
+
"."
|
17
|
+
else
|
18
|
+
klass = klass.class
|
19
|
+
"#"
|
20
|
+
end
|
21
|
+
|
22
|
+
method = "#{klass}#{msep}#{options.fetch(:method)}"
|
23
|
+
pre = " #{options[:pre]}" if options[:pre]
|
24
|
+
post = case options[:next]
|
25
|
+
when :private, :protected
|
26
|
+
" and will be made #{options[:next]}"
|
27
|
+
when :removed
|
28
|
+
" and will be removed"
|
29
|
+
when nil, ""
|
30
|
+
nil
|
31
|
+
else
|
32
|
+
" #{options[:next]}"
|
33
|
+
end
|
34
|
+
|
35
|
+
<<-WARNING.chomp.strip
|
36
|
+
#{caller(2..2).first}: #{klass}#{msep}#{method}#{pre} is deprecated#{post}.
|
37
|
+
WARNING
|
38
|
+
end
|
39
|
+
|
40
|
+
if !__deprecation_logged?(message, options[:once])
|
41
|
+
MIME::Types.logger.__send__(options[:level] || :debug, message)
|
42
|
+
end
|
43
|
+
|
44
|
+
return unless block
|
45
|
+
block.call
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def __deprecation_logged?(message, once)
|
51
|
+
return false unless once
|
52
|
+
|
53
|
+
@__deprecations_logged = {} unless defined?(@__deprecations_logged)
|
54
|
+
@__deprecations_logged.key?(message)
|
55
|
+
end
|
56
|
+
end
|
@@ -13,7 +13,7 @@ require "mime/types/data"
|
|
13
13
|
#
|
14
14
|
# The Loader will use one of the following paths:
|
15
15
|
# 1. The +path+ provided in its constructor argument;
|
16
|
-
# 2. The value of ENV[
|
16
|
+
# 2. The value of ENV["RUBY_MIME_TYPES_DATA"]; or
|
17
17
|
# 3. The value of MIME::Types::Data::PATH.
|
18
18
|
#
|
19
19
|
# When #load is called, the +path+ will be searched recursively for all YAML
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "mime/types/deprecations"
|
4
|
+
|
3
5
|
class << MIME::Types
|
4
6
|
include Enumerable
|
5
7
|
|
@@ -45,11 +47,11 @@ class << MIME::Types
|
|
45
47
|
def lazy_load?
|
46
48
|
return unless ENV.key?("RUBY_MIME_TYPES_LAZY_LOAD")
|
47
49
|
|
48
|
-
|
49
|
-
Lazy loading ($RUBY_MIME_TYPES_LAZY_LOAD) is deprecated and will be removed.
|
50
|
-
|
50
|
+
deprecated(
|
51
|
+
message: "Lazy loading ($RUBY_MIME_TYPES_LAZY_LOAD) is deprecated and will be removed."
|
52
|
+
)
|
51
53
|
|
52
|
-
|
54
|
+
ENV["RUBY_MIME_TYPES_LAZY_LOAD"] != "false"
|
53
55
|
end
|
54
56
|
|
55
57
|
def __types__
|