transcriber 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/.gitignore +1 -0
  2. data/Guardfile +7 -0
  3. data/README.md +39 -0
  4. data/examples/all.rb +14 -0
  5. data/examples/embeds_many/simple.rb +14 -0
  6. data/examples/embeds_many/with_class_name.rb +14 -0
  7. data/examples/embeds_many/with_if.rb +21 -0
  8. data/examples/embeds_many/with_start_key.rb +17 -0
  9. data/examples/embeds_one/simple.rb +14 -0
  10. data/examples/embeds_one/with_class_name.rb +14 -0
  11. data/examples/embeds_one/with_if.rb +21 -0
  12. data/examples/embeds_one/with_start_key.rb +14 -0
  13. data/examples/has_many/simple.rb +29 -0
  14. data/examples/properties/simple.rb +10 -0
  15. data/examples/properties/with_field.rb +10 -0
  16. data/examples/properties/with_field_path.rb +10 -0
  17. data/examples/properties/with_id.rb +10 -0
  18. data/examples/properties/with_if.rb +19 -0
  19. data/examples/properties/with_key_converter.rb +20 -0
  20. data/lib/transcriber/configuration.rb +13 -0
  21. data/lib/transcriber/resource/builder/embeddables.rb +21 -0
  22. data/lib/transcriber/resource/builder/keys.rb +20 -0
  23. data/lib/transcriber/resource/builder/properties.rb +29 -0
  24. data/lib/transcriber/resource/builder/relations.rb +26 -0
  25. data/lib/transcriber/resource/builder/summarizations.rb +14 -0
  26. data/lib/transcriber/resource/builder.rb +10 -0
  27. data/lib/transcriber/resource/input_path.rb +19 -0
  28. data/lib/transcriber/resource/key/association.rb +29 -0
  29. data/lib/transcriber/resource/key/embeddable.rb +8 -0
  30. data/lib/transcriber/resource/key/property.rb +17 -0
  31. data/lib/transcriber/resource/key/relation.rb +24 -0
  32. data/lib/transcriber/resource/key.rb +29 -0
  33. data/lib/transcriber/resource/parser/embeddable.rb +12 -0
  34. data/lib/transcriber/resource/parser/property.rb +15 -0
  35. data/lib/transcriber/resource/parser.rb +21 -18
  36. data/lib/transcriber/resource/response/embeddable.rb +14 -0
  37. data/lib/transcriber/resource/response/property.rb +11 -0
  38. data/lib/transcriber/resource/response/relation.rb +39 -0
  39. data/lib/transcriber/resource/response.rb +11 -0
  40. data/lib/transcriber/resource/serialization/boolean.rb +32 -9
  41. data/lib/transcriber/resource/serialization/date.rb +7 -7
  42. data/lib/transcriber/resource/serialization/float.rb +9 -5
  43. data/lib/transcriber/resource/serialization/integer.rb +13 -0
  44. data/lib/transcriber/resource/serialization/string.rb +7 -5
  45. data/lib/transcriber/resource.rb +34 -14
  46. data/lib/transcriber/version.rb +1 -1
  47. data/lib/transcriber.rb +38 -2
  48. data/spec/integration/has_many_spec.rb +9 -0
  49. data/spec/integration/property_spec.rb +0 -0
  50. data/spec/spec_helper.rb +22 -1
  51. data/spec/support/examples.rb +21 -0
  52. data/spec/support/out.rb +17 -0
  53. data/spec/unit/configuration_spec.rb +24 -0
  54. data/spec/unit/input_path_spec.rb +68 -0
  55. data/spec/unit/key_spec.rb +48 -0
  56. data/spec/{resource → unit}/parser_spec.rb +16 -21
  57. data/spec/unit/resource/builder/embeddables_spec.rb +27 -0
  58. data/spec/unit/resource/builder/properties_spec.rb +154 -0
  59. data/spec/unit/resource/builder/relations_spec.rb +54 -0
  60. data/spec/unit/resource/builder/shared_example_for_association.rb +20 -0
  61. data/spec/unit/resource/builder/summarize_spec.rb +0 -0
  62. data/spec/unit/resource/key/association_spec.rb +69 -0
  63. data/spec/unit/resource/key/embeddable_spec.rb +7 -0
  64. data/spec/unit/resource/key/property_spec.rb +39 -0
  65. data/spec/unit/resource/key/relation_spec.rb +71 -0
  66. data/spec/unit/resource/parser/embeddable_spec.rb +38 -0
  67. data/spec/unit/resource/parser/property_spec.rb +31 -0
  68. data/spec/unit/resource/response/embeddable_spec.rb +55 -0
  69. data/spec/unit/resource/response/property_spec.rb +22 -0
  70. data/spec/unit/resource/response/relation_spec.rb +105 -0
  71. data/spec/unit/resource/serialization/boolean_spec.rb +25 -0
  72. data/spec/unit/resource/serialization/date_spec.rb +13 -0
  73. data/spec/unit/resource/serialization/float_spec.rb +13 -0
  74. data/spec/unit/resource/serialization/integer_spec.rb +13 -0
  75. data/spec/unit/resource/serialization/string_spec.rb +11 -0
  76. data/spec/unit/resource_spec.rb +46 -0
  77. data/spec/unit/response_spec.rb +44 -0
  78. data/transcriber.gemspec +7 -3
  79. metadata +146 -22
  80. data/lib/transcriber/resource/embeddables/embeddable.rb +0 -31
  81. data/lib/transcriber/resource/embeddables/parser.rb +0 -10
  82. data/lib/transcriber/resource/embeddables/resource.rb +0 -9
  83. data/lib/transcriber/resource/embeddables.rb +0 -18
  84. data/lib/transcriber/resource/properties/parser.rb +0 -9
  85. data/lib/transcriber/resource/properties/property.rb +0 -30
  86. data/lib/transcriber/resource/properties/resource.rb +0 -7
  87. data/lib/transcriber/resource/properties.rb +0 -8
  88. data/lib/transcriber/resource/responses.rb +0 -13
  89. data/lib/transcriber/resource/serialization.rb +0 -10
  90. data/spec/resource/embeddables_spec.rb +0 -228
  91. data/spec/resource/properties_spec.rb +0 -69
  92. data/spec/resource_spec.rb +0 -27
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .rvmrc
1
2
  *.gem
2
3
  .bundle
3
4
  Gemfile.lock
data/Guardfile ADDED
@@ -0,0 +1,7 @@
1
+ guard 'rspec', cli: '--color' do
2
+ watch(%r{spec/spec_helper.rb}) { "spec" }
3
+ watch(%r{^config\/(.*\/)*.*\.rb$}) { "spec" }
4
+
5
+ watch(%r{^spec/.+_spec\.rb})
6
+ watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
7
+ end
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Transcriber
2
+
3
+
4
+ ## Installation
5
+
6
+ gem install transciber
7
+
8
+ ## Usage
9
+
10
+ [See Examples](https://github.com/rodrigues/transcriber/tree/master/examples)
11
+
12
+ ## Maintainers
13
+
14
+ * [Victor Rodrigues](http://github.com/rodrigues)
15
+ * [William "Kina"](http://github.com/kina)
16
+ * [Guilherme Guimarães Filho](http://github.com/gguimaraesbr)
17
+
18
+ ## License
19
+
20
+ (The MIT License)
21
+
22
+ Permission is hereby granted, free of charge, to any person obtaining
23
+ a copy of this software and associated documentation files (the
24
+ 'Software'), to deal in the Software without restriction, including
25
+ without limitation the rights to use, copy, modify, merge, publish,
26
+ distribute, sublicense, and/or sell copies of the Software, and to
27
+ permit persons to whom the Software is furnished to do so, subject to
28
+ the following conditions:
29
+
30
+ The above copyright notice and this permission notice shall be
31
+ included in all copies or substantial portions of the Software.
32
+
33
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
34
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
35
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
36
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
37
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
38
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
39
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/examples/all.rb ADDED
@@ -0,0 +1,14 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ Dir["examples/*/**.rb"].each do |file|
4
+ [:Root, :Item, :Customer, :Entry].each do |klass|
5
+ Object.send(:remove_const, klass) if Object.const_defined? klass
6
+ end
7
+
8
+ puts
9
+ puts
10
+ p "example file: #{file}"
11
+ puts
12
+ puts
13
+ load file
14
+ end
@@ -0,0 +1,14 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ class Item < Transcriber::Resource
4
+ property :id
5
+ end
6
+
7
+ class Root < Transcriber::Resource
8
+ embeds_many :items
9
+ end
10
+
11
+ root = Root.parse({"items" => [{"id" => 2000}]}).first
12
+
13
+ puts "root: #{root.inspect}"
14
+ puts "resource: #{root.resource}"
@@ -0,0 +1,14 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ class Entry < Transcriber::Resource
4
+ property :id
5
+ end
6
+
7
+ class Root < Transcriber::Resource
8
+ embeds_many :items, class_name: :entry
9
+ end
10
+
11
+ root = Root.parse({"items" => [{"id" => 2000}]}).first
12
+
13
+ puts "root: #{root.inspect}"
14
+ puts "resource: #{root.resource}"
@@ -0,0 +1,21 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ class Item < Transcriber::Resource
4
+ property :id
5
+ end
6
+
7
+ class Root < Transcriber::Resource
8
+ property :id
9
+ embeds_many :items, if: proc {id == "10"}
10
+ end
11
+
12
+ root = Root.parse({"id" => 10, "items" => [{"id" => 2000}]}).first
13
+
14
+ puts "root: #{root.inspect}"
15
+ puts "resource: #{root.resource}"
16
+
17
+
18
+ root = Root.parse({"id" => 1, "items" => [{"id" => 2000}]}).first
19
+
20
+ puts "root: #{root.inspect}"
21
+ puts "resource: #{root.resource}"
@@ -0,0 +1,17 @@
1
+ require 'json'
2
+
3
+ $:.push 'lib'; require 'transcriber'
4
+
5
+ class Item < Transcriber::Resource
6
+ property :id, field: :item_id
7
+ end
8
+
9
+ class Root < Transcriber::Resource
10
+ embeds_many :items, start_key: 'detalhe.itens'
11
+ end
12
+
13
+ root = Root.parse({"detalhe" => {"itens" => [{"item_id" => 2000}]}}).first
14
+
15
+ puts "root: #{root.inspect}"
16
+ puts "resource: #{root.resource}"
17
+ puts "to_json: #{root.resource.to_json}"
@@ -0,0 +1,14 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ class Root < Transcriber::Resource
4
+ embeds_one :item
5
+ end
6
+
7
+ class Item < Transcriber::Resource
8
+ property :id
9
+ end
10
+
11
+ root = Root.parse({"item" => {"id" => 2000}}).first
12
+
13
+ puts "root: #{root.inspect}"
14
+ puts "resource: #{root.resource}"
@@ -0,0 +1,14 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ class Entry < Transcriber::Resource
4
+ property :id
5
+ end
6
+
7
+ class Root < Transcriber::Resource
8
+ embeds_one :item, class_name: :entry
9
+ end
10
+
11
+ root = Root.parse({"item" => {"id" => 2000}}).first
12
+
13
+ puts "root: #{root.inspect}"
14
+ puts "resource: #{root.resource}"
@@ -0,0 +1,21 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ class Root < Transcriber::Resource
4
+ property :id
5
+ embeds_one :item, if: proc {id == "1"}
6
+ end
7
+
8
+ class Item < Transcriber::Resource
9
+ property :id
10
+ end
11
+
12
+ root = Root.parse({"id"=> 1, "item" => {"id" => 2000}}).first
13
+
14
+ puts "root: #{root.inspect}"
15
+ puts "resource: #{root.resource}"
16
+
17
+
18
+ root = Root.parse({"id"=> 100, "item" => {"id" => 2000}}).first
19
+
20
+ puts "root: #{root.inspect}"
21
+ puts "resource: #{root.resource}"
@@ -0,0 +1,14 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ class Root < Transcriber::Resource
4
+ embeds_one :item, start_key: :ugly_nesting_key
5
+ end
6
+
7
+ class Item < Transcriber::Resource
8
+ property :id
9
+ end
10
+
11
+ root = Root.parse({"ugly_nesting_key" => {"id" => 2000}}).first
12
+
13
+ puts "root: #{root.inspect}"
14
+ puts "resource: #{root.resource}"
@@ -0,0 +1,29 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ class Service < Transcriber::Resource
4
+ property :name
5
+ belongs_to :customer
6
+ end
7
+
8
+ class Billing < Transcriber::Resource
9
+ property :login
10
+ belongs_to :customer
11
+ end
12
+
13
+ class Developer < Transcriber::Resource
14
+ property :login
15
+ belongs_to :customer
16
+ end
17
+
18
+ class Customer < Transcriber::Resource
19
+ id field: :customer_id
20
+ property :login
21
+ has_many :services
22
+ has_one :billing
23
+ has_one :devopada, class_name: :developer
24
+ end
25
+
26
+ @root = Customer.parse({"customer_id" => 123, "login" => 2000}).first
27
+
28
+ puts "root: #{@root.inspect}"
29
+ puts "resource: #{@root.resource}"
@@ -0,0 +1,10 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ class Customer < Transcriber::Resource
4
+ property :login
5
+ end
6
+
7
+ root = Customer.parse({"login" => 2000}).first
8
+
9
+ puts "root: #{root.inspect}"
10
+ puts "resource: #{root.resource}"
@@ -0,0 +1,10 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ class Customer < Transcriber::Resource
4
+ property :login, field: :customer_login
5
+ end
6
+
7
+ root = Customer.parse({"customer_login" => 2000}).first
8
+
9
+ puts "root: #{root.inspect}"
10
+ puts "resource: #{root.resource}"
@@ -0,0 +1,10 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ class Customer < Transcriber::Resource
4
+ property :login, field: 'hidden.login'
5
+ end
6
+
7
+ root = Customer.parse({"hidden" => {"login" => 2000}}).first
8
+
9
+ puts "root: #{root.inspect}"
10
+ puts "resource: #{root.resource}"
@@ -0,0 +1,10 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ class Customer < Transcriber::Resource
4
+ id
5
+ end
6
+
7
+ root = Customer.parse({"id" => 2000}).first
8
+
9
+ puts "root: #{root.inspect}"
10
+ puts "resource: #{root.resource}"
@@ -0,0 +1,19 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ class Customer < Transcriber::Resource
4
+ property :login
5
+ property :password
6
+ property :some_text, if: proc {password == "abc"}
7
+ end
8
+
9
+ root = Customer.parse({"login" => 2000, "password" => "abc", "some_text" => "some text"}).first
10
+
11
+
12
+ puts "root: #{root.inspect}"
13
+ puts "resource: #{root.resource}"
14
+
15
+
16
+ root = Customer.parse({"login" => 2000, "password" => "abcd", "some_text" => "some text II"}).first
17
+
18
+ puts "root: #{root.inspect}"
19
+ puts "resource: #{root.resource}"
@@ -0,0 +1,20 @@
1
+ $:.push 'lib'; require 'transcriber'
2
+
3
+ module Upcasing
4
+ def self.call(keys)
5
+ keys.map {|key| key.to_s.upcase}
6
+ end
7
+ end
8
+
9
+ Transcriber.configure do |c|
10
+ c.convert_input_keys = Upcasing
11
+ end
12
+
13
+ class Customer < Transcriber::Resource
14
+ property :login
15
+ end
16
+
17
+ root = Customer.parse({"LOGIN" => 2000}).first
18
+
19
+ puts "root: #{root.inspect}"
20
+ puts "resource: #{root.resource}"
@@ -0,0 +1,13 @@
1
+ module Transcriber
2
+ class Configuration
3
+ DefaultHandler = lambda {|keys| keys.map(&:to_s)}
4
+
5
+ def convert_input_keys
6
+ @convert_input_keys || DefaultHandler
7
+ end
8
+
9
+ def convert_input_keys=(converter)
10
+ @convert_input_keys = converter
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ module Transcriber
2
+ class Resource
3
+ module Builder
4
+ module Embeddables
5
+ def embeds(name, options)
6
+ key Embeddable.new(name, options)
7
+ end
8
+
9
+ def embeds_one(name, options = {})
10
+ options.merge!(many: false)
11
+ embeds(name, options)
12
+ end
13
+
14
+ def embeds_many(name, options = {})
15
+ options.merge!(many: true)
16
+ embeds(name, options)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ module Transcriber
2
+ class Resource
3
+ module Builder
4
+ module Keys
5
+ def key(key)
6
+ fail "you can't define a key with name '#{key.name}'" if not_allowed?(key)
7
+ attr_accessor key.name
8
+ self.keys << key
9
+ self.id_key = key if key.options[:id]
10
+ end
11
+
12
+ private
13
+
14
+ def not_allowed?(key)
15
+ Resource.not_allowed_names.include?(key.name.to_s)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,29 @@
1
+ module Transcriber
2
+ class Resource
3
+ module Builder
4
+ module Properties
5
+ def property(name, options = {})
6
+ key Property.new(name, options)
7
+ end
8
+
9
+ def properties(*args)
10
+ options = options(args)
11
+ names = args
12
+ names.each {|name| property(name, options)}
13
+ end
14
+
15
+ def id(*args)
16
+ options = options(args)
17
+ name = args.fetch(0, :id)
18
+ property(name, options.merge(id: true))
19
+ end
20
+
21
+ private
22
+
23
+ def options(args)
24
+ args.last.kind_of?(Hash) ? args.pop : {}
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,26 @@
1
+ module Transcriber
2
+ class Resource
3
+ module Builder
4
+ module Relations
5
+ def relation(name, options)
6
+ key Relation.new(name, options)
7
+ end
8
+
9
+ def has_one(name, options = {})
10
+ options.merge!(many: false, has: true)
11
+ relation(name, options)
12
+ end
13
+
14
+ def has_many(name, options = {})
15
+ options.merge!(many: true, has: true)
16
+ relation(name, options)
17
+ end
18
+
19
+ def belongs_to(name, options = {})
20
+ options.merge!(many: false, has: false)
21
+ relation(name, options)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,14 @@
1
+ module Transcriber
2
+ class Resource
3
+ module Builder
4
+ module Summarization
5
+ def summarizes(*args = [])
6
+ args.each do |name|
7
+ key = keys.find {|key| key.name == name}
8
+ key.summarize = true if key
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ module Transcriber
2
+ class Resource
3
+ module Builder
4
+ include Keys
5
+ include Relations
6
+ include Embeddables
7
+ include Properties
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,19 @@
1
+ module Transcriber
2
+ class Resource
3
+ module InputPath
4
+ def self.resolve(options, convert_input_keys = Key::Converter::DefaultHandler)
5
+ convert_input_keys.call keys_for_path(custom_path(options))
6
+ end
7
+
8
+ private
9
+
10
+ def self.custom_path(options)
11
+ options.slice(:start_key, :field)
12
+ end
13
+
14
+ def self.keys_for_path(path)
15
+ path.empty? ? [] : path.values.first.to_s.split('.')
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,29 @@
1
+ module Transcriber
2
+ class Resource
3
+ class Association < Key
4
+ attr_reader :many
5
+
6
+ def initialize(name, options = {})
7
+ super
8
+ @many = options.fetch(:many, false)
9
+ @class_name = options.fetch(:class_name, default_class_name).to_s.camelize
10
+ end
11
+
12
+ def one?
13
+ !many?
14
+ end
15
+
16
+ def many?
17
+ @many
18
+ end
19
+
20
+ def default_class_name
21
+ one? ? name : name.to_s.singularize
22
+ end
23
+
24
+ def resource_class
25
+ @class_name.constantize
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,8 @@
1
+ module Transcriber
2
+ class Resource
3
+ class Embeddable < Association
4
+ include Parser::Embeddable
5
+ include Response::Embeddable
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,17 @@
1
+ module Transcriber
2
+ class Resource
3
+ class Property < Key
4
+ include Parser::Property
5
+ include Response::Property
6
+
7
+ attr_accessor :serializer
8
+ attr_accessor :translations
9
+
10
+ def initialize(name, options = {})
11
+ super
12
+ @serializer = options.fetch(:type, Serialization::String)
13
+ @translations = options[:values].try(:invert)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,24 @@
1
+ module Transcriber
2
+ class Resource
3
+ class Relation < Association
4
+ include Response::Relation
5
+
6
+ def initialize(name, options = {})
7
+ super
8
+ @has = options.fetch(:has, false)
9
+ end
10
+
11
+ def has?
12
+ @has
13
+ end
14
+
15
+ def belongs?
16
+ !has?
17
+ end
18
+
19
+ def parse(value)
20
+ nil
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,29 @@
1
+ module Transcriber
2
+ class Resource
3
+ class Key
4
+ attr_accessor :name
5
+ attr_accessor :options
6
+ attr_accessor :summarize
7
+
8
+ def initialize(name, options = {})
9
+ @name = name
10
+ @options = options
11
+ end
12
+
13
+ def present?(resource)
14
+ return true unless options[:if]
15
+ resource.instance_eval &options[:if]
16
+ end
17
+
18
+ def input_path
19
+ return @input_path if @input_path
20
+ path = InputPath.resolve(options, convert_input_keys)
21
+ @input_path = path.empty? ? convert_input_keys.call([name]) : path
22
+ end
23
+
24
+ def convert_input_keys
25
+ options.fetch(:convert_input_keys, Transcriber.configuration.convert_input_keys)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,12 @@
1
+ module Transcriber
2
+ class Resource
3
+ module Parser
4
+ module Embeddable
5
+ def parse(value)
6
+ parsed_value = resource_class.parse(value)
7
+ one? ? parsed_value.first : parsed_value
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module Transcriber
2
+ class Resource
3
+ module Parser
4
+ module Property
5
+ def parse(value)
6
+ translate serializer.serialize(value)
7
+ end
8
+
9
+ def translate(value)
10
+ translations ? translations[value] : value
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end