opushon 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -2
- data/VERSION.semver +1 -1
- data/lib/opushon/error/min_is_greater_than_max_error.rb +8 -0
- data/lib/opushon/error/minlen_is_longer_than_maxlen_error.rb +8 -0
- data/lib/opushon/instance.rb +4 -13
- data/lib/opushon/option_object.rb +19 -39
- data/lib/opushon/parameter/base.rb +47 -0
- data/lib/opushon/parameter/input.rb +34 -0
- data/lib/opushon/parameter/output.rb +10 -0
- data/lib/opushon/parameter.rb +9 -0
- data/lib/opushon/restricted_value.rb +35 -0
- data/lib/opushon/type/array.rb +10 -0
- data/lib/opushon/type/base.rb +12 -5
- data/lib/opushon/type/boolean.rb +0 -3
- data/lib/opushon/type/hash.rb +10 -0
- data/lib/opushon/type/number.rb +15 -13
- data/lib/opushon/type/string.rb +18 -13
- data/lib/opushon/verb.rb +0 -2
- data/lib/opushon/version.rb +2 -0
- data/opushon.gemspec +0 -1
- data/spec/opushon/parameter/input_spec.rb +161 -0
- data/spec/opushon/parameter/output_spec.rb +108 -0
- data/spec/opushon/parameter/spec_helper.rb +1 -0
- data/spec/opushon/restricted_value_spec.rb +42 -0
- data/spec/opushon_spec.rb +313 -323
- data/spec/support/immutable.rb +13 -13
- metadata +19 -18
- data/lib/opushon/attribute.rb +0 -29
- data/lib/opushon/option.rb +0 -14
data/spec/support/immutable.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
class Object
|
2
|
-
|
1
|
+
# class Object
|
2
|
+
# alias_method :overridden_initialize, :initialize
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
# def initialize
|
5
|
+
# overridden_initialize
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
7
|
+
# if !self.class.ancestors.include?(SimpleCov::Formatter::MultiFormatter) &&
|
8
|
+
# !self.class.ancestors.include?(SimpleCov::Formatter::HTMLFormatter) &&
|
9
|
+
# !self.class.ancestors.include?(Minitest::CompositeReporter) &&
|
10
|
+
# !self.class.ancestors.include?(Minitest::SummaryReporter) &&
|
11
|
+
# !self.class.ancestors.include?(Minitest::ProgressReporter)
|
12
|
+
# freeze
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
# end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opushon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Wack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: yard
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.8'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0.8'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: coveralls
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,17 +83,24 @@ files:
|
|
97
83
|
- Rakefile
|
98
84
|
- VERSION.semver
|
99
85
|
- lib/opushon.rb
|
100
|
-
- lib/opushon/attribute.rb
|
101
86
|
- lib/opushon/error.rb
|
102
87
|
- lib/opushon/error/base_error.rb
|
88
|
+
- lib/opushon/error/min_is_greater_than_max_error.rb
|
89
|
+
- lib/opushon/error/minlen_is_longer_than_maxlen_error.rb
|
103
90
|
- lib/opushon/error/syntax_error.rb
|
104
91
|
- lib/opushon/error/verb_error.rb
|
105
92
|
- lib/opushon/instance.rb
|
106
|
-
- lib/opushon/option.rb
|
107
93
|
- lib/opushon/option_object.rb
|
94
|
+
- lib/opushon/parameter.rb
|
95
|
+
- lib/opushon/parameter/base.rb
|
96
|
+
- lib/opushon/parameter/input.rb
|
97
|
+
- lib/opushon/parameter/output.rb
|
98
|
+
- lib/opushon/restricted_value.rb
|
108
99
|
- lib/opushon/type.rb
|
100
|
+
- lib/opushon/type/array.rb
|
109
101
|
- lib/opushon/type/base.rb
|
110
102
|
- lib/opushon/type/boolean.rb
|
103
|
+
- lib/opushon/type/hash.rb
|
111
104
|
- lib/opushon/type/number.rb
|
112
105
|
- lib/opushon/type/string.rb
|
113
106
|
- lib/opushon/verb.rb
|
@@ -120,6 +113,10 @@ files:
|
|
120
113
|
- lib/opushon/verb/put.rb
|
121
114
|
- lib/opushon/version.rb
|
122
115
|
- opushon.gemspec
|
116
|
+
- spec/opushon/parameter/input_spec.rb
|
117
|
+
- spec/opushon/parameter/output_spec.rb
|
118
|
+
- spec/opushon/parameter/spec_helper.rb
|
119
|
+
- spec/opushon/restricted_value_spec.rb
|
123
120
|
- spec/opushon/spec_helper.rb
|
124
121
|
- spec/opushon/version_spec.rb
|
125
122
|
- spec/opushon_spec.rb
|
@@ -153,6 +150,10 @@ signing_key:
|
|
153
150
|
specification_version: 4
|
154
151
|
summary: A HTTP Opushon parser and emitter
|
155
152
|
test_files:
|
153
|
+
- spec/opushon/parameter/input_spec.rb
|
154
|
+
- spec/opushon/parameter/output_spec.rb
|
155
|
+
- spec/opushon/parameter/spec_helper.rb
|
156
|
+
- spec/opushon/restricted_value_spec.rb
|
156
157
|
- spec/opushon/spec_helper.rb
|
157
158
|
- spec/opushon/version_spec.rb
|
158
159
|
- spec/opushon_spec.rb
|
data/lib/opushon/attribute.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require_relative 'type'
|
2
|
-
|
3
|
-
# Namespace for the Opushon library.
|
4
|
-
module Opushon
|
5
|
-
# Parse a Opushon string in opushon.
|
6
|
-
class Attribute
|
7
|
-
def initialize(properties)
|
8
|
-
type = properties.delete('type') { 'string' }
|
9
|
-
@type = Type.const_get(type.capitalize).new(properties)
|
10
|
-
|
11
|
-
@nullifiable = properties.delete('nullifiable') { true }
|
12
|
-
@multiple = properties.delete('multiple') { false }
|
13
|
-
@description = properties.delete('description') { '' }
|
14
|
-
@options = properties.delete('options') { nil }
|
15
|
-
|
16
|
-
@other_settings = properties
|
17
|
-
end
|
18
|
-
|
19
|
-
# Dump attribute's properties to a hash.
|
20
|
-
def to_h
|
21
|
-
{
|
22
|
-
'nullifiable' => @nullifiable,
|
23
|
-
'multiple' => @multiple,
|
24
|
-
'description' => @description,
|
25
|
-
'options' => @options
|
26
|
-
}.merge(@other_settings).merge(@type.to_h)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/lib/opushon/option.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# Namespace for the Opushon library.
|
2
|
-
module Opushon
|
3
|
-
# Parse a Opushon string in opushon.
|
4
|
-
class Option
|
5
|
-
def initialize(option_object)
|
6
|
-
@option_object = option_object
|
7
|
-
end
|
8
|
-
|
9
|
-
# Dump instance's opushon to a hash.
|
10
|
-
def to_h
|
11
|
-
@option_object.to_h
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|