bluepine 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0562448be374df38a2347cb1c9ef43fe4c46acfc958667d635c92b60f0bc7ec
4
- data.tar.gz: 7a918a8d707bef2fd58d2f057ed278632736efb55d92c996cd0cdc29720864a0
3
+ metadata.gz: 30e17cc0fa9d9f10980d7a7cb47b356455e40c869b63a58d5f76f32e9b030003
4
+ data.tar.gz: 3e980cd37141c4450df4e740d5f7e1cb0be1c307c03bb8cc051b677677d2bd3b
5
5
  SHA512:
6
- metadata.gz: 55ee6489f9ec02830053678e5a8f91d90623253b4557dfea0cc0d70b6494df91b25e9b15e383a198453aef3d2e372b804265e59599aceae79fdb55749f552852
7
- data.tar.gz: 5e34ebb0284cb702af6858c8d86a0314c4f15266244f9520a12e3d40a0ead017da6b12e0d37e90d909897cfdac754252879e8ae7438773476020a6ea2b2d265f
6
+ metadata.gz: 35d96e45f5a7da08bc4702280899fa549e9be4cc392ba40acac9bf2ba85893fd9671b67a4c9a48f5abecbad9bae7df530ce1c9cfd7bbbc5827f8a7c211343c10
7
+ data.tar.gz: a7a5d27ec69517cd36a385695caca172923765cefa7dd6ea3b53a76429f1e22713710d701216f9b5c2bb442e009487332228a0926f541499e76ddbf4c45d4579
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Bluepine
2
2
 
3
+ ![CircleCI](https://img.shields.io/circleci/project/omise/bluepine.svg?style=flat)
4
+
3
5
  `Bluepine` is a DSL for defining API [Schema](#schema)/[Endpoint](#endpoint) with the capabilities to generate `Open API (v3)` spec (other specs is coming soon), validate API request and serialize object for API response based on single schema definition.
4
6
 
5
7
  ## Table of Contents
@@ -1,7 +1,7 @@
1
- require 'active_support/concern'
2
1
  require 'active_model'
3
2
 
4
3
  require "bluepine/version"
4
+ require "bluepine/support"
5
5
  require "bluepine/functions"
6
6
  require "bluepine/assertions"
7
7
  require "bluepine/error"
@@ -1,24 +1,22 @@
1
1
  module Bluepine
2
2
  module Serializers
3
3
  module Serializable
4
- extend ActiveSupport::Concern
4
+ extend Bluepine::Support
5
5
 
6
6
  included do
7
- # Serializer
8
- class_attribute :serializer
7
+ class << self
8
+ attr_accessor :serializer
9
+
10
+ def serializer
11
+ @serializer || superclass.serializer
12
+ end
13
+ end
9
14
 
10
- # Default serializer
11
15
  self.serializer = ->(v) { v }
12
16
  end
13
17
 
14
18
  def serialize(value)
15
- self.class.serialize(value)
16
- end
17
-
18
- module ClassMethods
19
- def serialize(value)
20
- serializer.(value)
21
- end
19
+ self.class.serializer.(value)
22
20
  end
23
21
  end
24
22
  end
@@ -0,0 +1,13 @@
1
+ module Bluepine
2
+ module Support
3
+ # Mimic Active Support's .included behaviours
4
+ def included(base = nil, &block)
5
+ if base.nil?
6
+ @_included_block = block
7
+ else
8
+ base.extend const_get(:ClassMethods) if const_defined?(:ClassMethods)
9
+ base.class_eval &@_included_block if instance_variable_defined?(:@_included_block)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,24 +1,23 @@
1
1
  module Bluepine
2
2
  module Validators
3
3
  module Normalizable
4
- extend ActiveSupport::Concern
4
+ extend Bluepine::Support
5
5
 
6
6
  included do
7
- # Normalizes value before passing it to validator
8
- class_attribute :normalizer
7
+ class << self
8
+ # Normalizes value before passing it to validator
9
+ attr_accessor :normalizer
10
+
11
+ def normalizer
12
+ @normalizer || superclass.normalizer
13
+ end
14
+ end
9
15
 
10
- # Default normalizer
11
16
  self.normalizer = ->(v) { v }
12
17
  end
13
18
 
14
19
  def normalize(value)
15
- self.class.normalize(value)
16
- end
17
-
18
- module ClassMethods
19
- def normalize(value)
20
- normalizer.(value)
21
- end
20
+ self.class.normalizer.(value)
22
21
  end
23
22
  end
24
23
  end
@@ -1,7 +1,7 @@
1
1
  module Bluepine
2
2
  module Validators
3
3
  module Validatable
4
- extend ActiveSupport::Concern
4
+ extend Bluepine::Support
5
5
 
6
6
  included do
7
7
  RULES = {}.freeze
@@ -1,3 +1,3 @@
1
1
  module Bluepine
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bluepine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marut K
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-10 00:00:00.000000000 Z
11
+ date: 2019-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '5.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '5.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: activemodel
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -179,6 +165,7 @@ files:
179
165
  - lib/bluepine/resolver.rb
180
166
  - lib/bluepine/serializer.rb
181
167
  - lib/bluepine/serializers/serializable.rb
168
+ - lib/bluepine/support.rb
182
169
  - lib/bluepine/validator.rb
183
170
  - lib/bluepine/validators/normalizable.rb
184
171
  - lib/bluepine/validators/proxy.rb