microsoft_kiota_serialization_multipart 0.25.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.
- checksums.yaml +7 -0
- data/Gemfile +15 -0
- data/Rakefile +8 -0
- data/lib/microsoft_kiota_serialization_multipart/multipart_serialization_writer.rb +55 -0
- data/lib/microsoft_kiota_serialization_multipart/multipart_serialization_writer_factory.rb +21 -0
- data/lib/microsoft_kiota_serialization_multipart/version.rb +5 -0
- data/lib/microsoft_kiota_serialization_multipart.rb +8 -0
- data/microsoft_kiota_serialization_multipart.gemspec +31 -0
- metadata +67 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8826e75aa0a846ce000a8ac476825288db3c8482aa29c714d0a8d664fe32100f
|
|
4
|
+
data.tar.gz: 5ae7f46c6d54516057ced429745d2b03aa4e2528bfa3235c5e36e2ab72964111
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 40e573b2f06e31394de701bb03c91d85cd15c9350229bcb75fcddffda5f9c3519a6bd7f98e8d16343ebde7bf155c9aef02ccecc5f91c0dea8cac1465483e1302
|
|
7
|
+
data.tar.gz: 006fb06e23b27e83b02374adf9d3ca574e1806c550dece4adb795a62ddf5fbf9f308de438f00ed215aa760db6912ccb102e15ec53199308b9cd0d9d163f2d54c
|
data/Gemfile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
|
+
|
|
5
|
+
ruby '>= 3.3.0'
|
|
6
|
+
|
|
7
|
+
gem 'microsoft_kiota_abstractions', path: '../../abstractions'
|
|
8
|
+
gem 'rake', '~> 13.0'
|
|
9
|
+
gem 'rspec', '~> 3.0'
|
|
10
|
+
|
|
11
|
+
group :test do
|
|
12
|
+
gem 'microsoft_kiota_serialization_json', path: '../json'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
gemspec
|
data/Rakefile
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'microsoft_kiota_abstractions'
|
|
4
|
+
|
|
5
|
+
module MicrosoftKiotaSerializationMultipart
|
|
6
|
+
class MultipartSerializationWriter
|
|
7
|
+
include MicrosoftKiotaAbstractions::SerializationWriter
|
|
8
|
+
|
|
9
|
+
def initialize
|
|
10
|
+
@content = String.new(encoding: Encoding::BINARY)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def write_string_value(key, value)
|
|
14
|
+
has_key = present?(key)
|
|
15
|
+
has_value = present?(value)
|
|
16
|
+
append(key) if has_key
|
|
17
|
+
append(': ') if has_key && has_value
|
|
18
|
+
append(value) if has_value
|
|
19
|
+
append("\r\n")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def write_byte_array_value(_key, value)
|
|
23
|
+
append(value) unless value.nil?
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def write_object_value(_key, value, *_additional_values_to_merge)
|
|
27
|
+
raise ArgumentError, "Expected a MultipartBody instance but got #{value.class}" unless value.is_a?(MicrosoftKiotaAbstractions::MultipartBody)
|
|
28
|
+
|
|
29
|
+
serialize_body(value)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def get_serialized_content
|
|
33
|
+
@content
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def present?(value)
|
|
39
|
+
!value.nil? && !value.empty?
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# every chunk is appended as bytes so UTF-8 text and raw binary parts can share the body
|
|
43
|
+
def append(chunk)
|
|
44
|
+
@content << chunk.b
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def serialize_body(value)
|
|
48
|
+
on_before_object_serialization&.call(value)
|
|
49
|
+
on_start_object_serialization&.call(value, self)
|
|
50
|
+
value.serialize(self)
|
|
51
|
+
ensure
|
|
52
|
+
on_after_object_serialization&.call(value)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'microsoft_kiota_abstractions'
|
|
4
|
+
require_relative 'multipart_serialization_writer'
|
|
5
|
+
|
|
6
|
+
module MicrosoftKiotaSerializationMultipart
|
|
7
|
+
class MultipartSerializationWriterFactory
|
|
8
|
+
include MicrosoftKiotaAbstractions::SerializationWriterFactory
|
|
9
|
+
|
|
10
|
+
def get_valid_content_type
|
|
11
|
+
'multipart/form-data'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def get_serialization_writer(content_type)
|
|
15
|
+
raise ArgumentError, 'content type cannot be undefined or empty' if content_type.nil? || content_type.empty?
|
|
16
|
+
raise ArgumentError, "expected a #{get_valid_content_type} content type" unless get_valid_content_type.casecmp?(content_type)
|
|
17
|
+
|
|
18
|
+
MultipartSerializationWriter.new
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'microsoft_kiota_serialization_multipart/multipart_serialization_writer'
|
|
4
|
+
require_relative 'microsoft_kiota_serialization_multipart/multipart_serialization_writer_factory'
|
|
5
|
+
require_relative 'microsoft_kiota_serialization_multipart/version'
|
|
6
|
+
|
|
7
|
+
module MicrosoftKiotaSerializationMultipart
|
|
8
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'lib/microsoft_kiota_serialization_multipart/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'microsoft_kiota_serialization_multipart'
|
|
7
|
+
spec.version = MicrosoftKiotaSerializationMultipart::VERSION
|
|
8
|
+
spec.authors = 'Microsoft Corporation'
|
|
9
|
+
spec.email = 'graphsdkpub+ruby@microsoft.com'
|
|
10
|
+
spec.description = 'Implementation of Kiota Serialization interfaces for multipart form data'
|
|
11
|
+
spec.summary = 'Microsoft Kiota Serialization - Ruby serialization for building library agnostic http client'
|
|
12
|
+
spec.homepage = 'https://learn.microsoft.com/openapi/kiota/'
|
|
13
|
+
spec.license = 'MIT'
|
|
14
|
+
spec.metadata = {
|
|
15
|
+
'bug_tracker_uri' => 'https://github.com/microsoft/kiota-ruby/issues',
|
|
16
|
+
'changelog_uri' => 'https://github.com/microsoft/kiota-ruby/blob/main/CHANGELOG.md',
|
|
17
|
+
'homepage_uri' => spec.homepage,
|
|
18
|
+
'source_code_uri' => 'https://github.com/microsoft/kiota-ruby/tree/main/components/serialization/multipart',
|
|
19
|
+
'github_repo' => 'ssh://github.com/microsoft/kiota-ruby',
|
|
20
|
+
'rubygems_mfa_required' => 'true'
|
|
21
|
+
}
|
|
22
|
+
spec.required_ruby_version = '>= 3.3.0'
|
|
23
|
+
|
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
25
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
|
26
|
+
end
|
|
27
|
+
spec.bindir = 'bin'
|
|
28
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
29
|
+
spec.require_paths = ['lib']
|
|
30
|
+
spec.add_dependency 'microsoft_kiota_abstractions', MicrosoftKiotaSerializationMultipart::VERSION
|
|
31
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: microsoft_kiota_serialization_multipart
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.25.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Microsoft Corporation
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: microsoft_kiota_abstractions
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - '='
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 0.25.0
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - '='
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 0.25.0
|
|
26
|
+
description: Implementation of Kiota Serialization interfaces for multipart form data
|
|
27
|
+
email: graphsdkpub+ruby@microsoft.com
|
|
28
|
+
executables: []
|
|
29
|
+
extensions: []
|
|
30
|
+
extra_rdoc_files: []
|
|
31
|
+
files:
|
|
32
|
+
- Gemfile
|
|
33
|
+
- Rakefile
|
|
34
|
+
- lib/microsoft_kiota_serialization_multipart.rb
|
|
35
|
+
- lib/microsoft_kiota_serialization_multipart/multipart_serialization_writer.rb
|
|
36
|
+
- lib/microsoft_kiota_serialization_multipart/multipart_serialization_writer_factory.rb
|
|
37
|
+
- lib/microsoft_kiota_serialization_multipart/version.rb
|
|
38
|
+
- microsoft_kiota_serialization_multipart.gemspec
|
|
39
|
+
homepage: https://learn.microsoft.com/openapi/kiota/
|
|
40
|
+
licenses:
|
|
41
|
+
- MIT
|
|
42
|
+
metadata:
|
|
43
|
+
bug_tracker_uri: https://github.com/microsoft/kiota-ruby/issues
|
|
44
|
+
changelog_uri: https://github.com/microsoft/kiota-ruby/blob/main/CHANGELOG.md
|
|
45
|
+
homepage_uri: https://learn.microsoft.com/openapi/kiota/
|
|
46
|
+
source_code_uri: https://github.com/microsoft/kiota-ruby/tree/main/components/serialization/multipart
|
|
47
|
+
github_repo: ssh://github.com/microsoft/kiota-ruby
|
|
48
|
+
rubygems_mfa_required: 'true'
|
|
49
|
+
rdoc_options: []
|
|
50
|
+
require_paths:
|
|
51
|
+
- lib
|
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
|
+
requirements:
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: 3.3.0
|
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
requirements: []
|
|
63
|
+
rubygems_version: 3.6.9
|
|
64
|
+
specification_version: 4
|
|
65
|
+
summary: Microsoft Kiota Serialization - Ruby serialization for building library agnostic
|
|
66
|
+
http client
|
|
67
|
+
test_files: []
|