xdr 3.0.0 → 3.0.1
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 +4 -4
- data/CHANGELOG.md +9 -3
- data/lib/xdr/concerns/converts_to_xdr.rb +1 -1
- data/lib/xdr/union.rb +8 -2
- data/lib/xdr/version.rb +1 -1
- data/spec/lib/xdr/union_spec.rb +10 -0
- data/xdr.gemspec +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf995b29e360c1ebdc82ee5c94ea470d7d8e87a577263f2faeb8fd3d7fce4a62
|
4
|
+
data.tar.gz: ad232ebcb97bef9e00e9fd1103a37cf87941171e5d6fdb89a38addef8ea1afa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7026fd132281c4955332ae9acbd4757c1e0d61e29b900139cc24475e8e347381da3c77f04896ea3841a81b790972fc8bc4fa0c79c36922315283921b6c456836
|
7
|
+
data.tar.gz: 9db16c2e581691273a475f6044fcff536accc8a9531c195571b784aaee2534f47409593b54d2c9102072ba9eea8a7871348dbafb789a99eee34e17b3b958d28b
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Changelog
|
1
|
+
# Changelog
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this
|
4
4
|
file. This project adheres to [Semantic Versioning](http://semver.org/).
|
@@ -6,12 +6,18 @@ file. This project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
As this project is pre 1.0, breaking changes may happen for minor version
|
7
7
|
bumps. A breaking change will get clearly notified in this log.
|
8
8
|
|
9
|
-
## [Unreleased](https://github.com/stellar/ruby-
|
9
|
+
## [Unreleased](https://github.com/stellar/ruby-xdr/compare/v3.0.1...master)
|
10
|
+
|
11
|
+
## [3.0.1](https://github.com/stellar/ruby-xdr/compare/v3.0.0...v3.0.1)
|
12
|
+
|
13
|
+
|
14
|
+
### Added
|
15
|
+
- Add encoding parameter to Union#to_xdr ((#7)[https://github.com/stellar/ruby-xdr/pull/7]).
|
10
16
|
|
11
17
|
### Fixed
|
12
18
|
- Padding bytes are now properly validated when reading xdr values. According to the XDR spec, padding must be zeros.
|
13
19
|
|
14
|
-
## [1.0.0](https://github.com/stellar/ruby-
|
20
|
+
## [1.0.0](https://github.com/stellar/ruby-xdr/compare/v0.1.0...v1.0.0)
|
15
21
|
|
16
22
|
### Added
|
17
23
|
- the `to_xdr` helpers can take a second parameter that will encode the resulting output to hex or base64 when requested.
|
data/lib/xdr/union.rb
CHANGED
@@ -75,8 +75,14 @@ class XDR::Union
|
|
75
75
|
set(switch, value) unless switch == :__unset__
|
76
76
|
end
|
77
77
|
|
78
|
-
|
79
|
-
|
78
|
+
#
|
79
|
+
# Serializes struct to xdr, return a string of bytes
|
80
|
+
#
|
81
|
+
# @param format=:raw [Symbol] The encoding used for the bytes produces, one of (:raw, :hex, :base64)
|
82
|
+
#
|
83
|
+
# @return [String] The encoded bytes of this struct
|
84
|
+
def to_xdr(format=:raw)
|
85
|
+
self.class.to_xdr(self, format)
|
80
86
|
end
|
81
87
|
|
82
88
|
def set(switch, value=:void)
|
data/lib/xdr/version.rb
CHANGED
data/spec/lib/xdr/union_spec.rb
CHANGED
@@ -186,6 +186,16 @@ describe XDR::Union, "#switch" do
|
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
189
|
+
describe XDR::Union, "#to_xdr" do
|
190
|
+
subject { UnionSpec::Result.new(:error, "spec error") }
|
191
|
+
|
192
|
+
context "with base64 encoding" do
|
193
|
+
it "returns base64 encoding of union's XDR" do
|
194
|
+
expect(subject.to_xdr(:base64)).to eq("AAAAAQAAAApzcGVjIGVycm9yAAA=")
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
189
199
|
module UnionSpec
|
190
200
|
class ResultType < XDR::Enum
|
191
201
|
member :ok, 0
|
data/xdr.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_dependency "activesupport", ">= 5.2.0"
|
21
21
|
spec.add_dependency "activemodel", ">= 5.2.0"
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler", "~> 1.
|
23
|
+
spec.add_development_dependency "bundler", "~> 2.1.4"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
25
|
spec.add_development_dependency "rspec", "~> 3.1"
|
26
26
|
spec.add_development_dependency "guard-rspec"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xdr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Fleckenstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.1.4
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.1.4
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -209,8 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: '0'
|
211
211
|
requirements: []
|
212
|
-
|
213
|
-
rubygems_version: 2.7.6
|
212
|
+
rubygems_version: 3.0.3
|
214
213
|
signing_key:
|
215
214
|
specification_version: 4
|
216
215
|
summary: XDR Helper Library
|