sinatra-avro 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sinatra/avro.rb +5 -5
- data/lib/sinatra/avro/version.rb +1 -1
- data/spec/avro_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbb66e2945cc1fed5ed0242ae42df4179e45ec59
|
4
|
+
data.tar.gz: c4fdc6ad51bbb1ddbdee55ebff73be95bec38ce4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 039d771a37fd21a4f4eca32ecc87e302d7f95156200ee61e5d4f34093259cdc1ff5781cbd7cc6c8c31df55597a1428b3f5b4e9b5fb1ad17fa7f30a657bc4df24
|
7
|
+
data.tar.gz: 57fac83514ff8d4e66b44a4f8df39adc71b946c5a9a5c91c6210dbbd4b3d8db47de7900d6d31dff2741ea501ac84da53d917260fe0b2970f7b31980e3da0883f
|
data/lib/sinatra/avro.rb
CHANGED
@@ -4,19 +4,19 @@ require 'avro_turf'
|
|
4
4
|
|
5
5
|
module Sinatra
|
6
6
|
module Avro
|
7
|
-
MIME_TYPE = "avro/binary".freeze
|
8
|
-
|
9
7
|
def avro(object, options = {})
|
8
|
+
schema_name = options.fetch(:schema_name) { raise "Please specify a schema name" }
|
9
|
+
full_schema_name = ::Avro::Name.make_fullname(schema_name, settings.avro_namespace)
|
10
|
+
|
10
11
|
# Set the Content-Type response header.
|
11
|
-
content_type
|
12
|
+
content_type "avro/binary; schema=#{full_schema_name}"
|
12
13
|
|
13
14
|
avro_encode(object, options)
|
14
15
|
end
|
15
16
|
|
16
17
|
private
|
17
18
|
|
18
|
-
def avro_encode(object,
|
19
|
-
schema_name = options.fetch(:schema_name) { raise "Please specify a schema name" }
|
19
|
+
def avro_encode(object, schema_name:)
|
20
20
|
@avro ||= AvroTurf.new(schemas_path: settings.avro_schema_dir, namespace: settings.avro_namespace)
|
21
21
|
@avro.encode(object, schema_name: schema_name)
|
22
22
|
end
|
data/lib/sinatra/avro/version.rb
CHANGED
data/spec/avro_spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe Sinatra::Avro do
|
|
21
21
|
|
22
22
|
it "sets the Content-Type header to avro/binary" do
|
23
23
|
response = get('/')
|
24
|
-
expect(response["Content-Type"]).to eq "avro/binary"
|
24
|
+
expect(response["Content-Type"]).to eq "avro/binary; schema=person"
|
25
25
|
end
|
26
26
|
|
27
27
|
def avro_decode(avro)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-avro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schierbeck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro_turf
|