camille 0.5.3 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/lib/camille/endpoint.rb +3 -1
- data/lib/camille/types/object.rb +9 -0
- data/lib/camille/types/string_literal.rb +2 -1
- data/lib/camille/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a587c953d4d716329e30ee94c7dfd2b67fcbb9d95b6aee5acc3a74ba7d8e2883
|
4
|
+
data.tar.gz: 28cf879c56d17ac119c2913c14d2ce09548c226b8f9120aa5fd5ccc3ab8334d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64ca501f703b329e9c4a8872a237480a4a751ffdbb82cadfc7ca67a31fcaffffd6c18c26d5eff045f69600c6bf2e6f82c9607b47ce83dbb9333a5b6d67f40692
|
7
|
+
data.tar.gz: 5d8951b905ad94aecc0b10756c9ff16bb25f9b6ee791c57694ad7bfdfd2f0c27cebe6e980b975f3a0cb17b3afa25a750d0808cfad221729e7d1c50caeba20e8e
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/camille/endpoint.rb
CHANGED
@@ -12,7 +12,9 @@ module Camille
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def signature
|
15
|
-
@response_type
|
15
|
+
unless @response_type
|
16
|
+
raise UnknownResponseError.new("Endpoint lacking a `response` definition.")
|
17
|
+
end
|
16
18
|
if @params_type
|
17
19
|
"#{ActiveSupport::Inflector.camelize @name, false}(params: #{@params_type.literal}): Promise<#{@response_type.literal}>"
|
18
20
|
else
|
data/lib/camille/types/object.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Camille
|
2
2
|
module Types
|
3
3
|
class Object < Camille::BasicType
|
4
|
+
class ArgumentError < ::ArgumentError; end
|
4
5
|
attr_reader :fields
|
5
6
|
|
6
7
|
def initialize fields
|
@@ -43,6 +44,7 @@ module Camille
|
|
43
44
|
private
|
44
45
|
def normalize_fields fields
|
45
46
|
fields.map do |key, value|
|
47
|
+
check_case_conversion_safe key
|
46
48
|
type = Camille::Type.instance(value)
|
47
49
|
if key.end_with?('?')
|
48
50
|
new_key = remove_question_mark(key)
|
@@ -57,6 +59,13 @@ module Camille
|
|
57
59
|
def remove_question_mark sym
|
58
60
|
sym.to_s.gsub(/\?$/, '').to_sym
|
59
61
|
end
|
62
|
+
|
63
|
+
def check_case_conversion_safe sym
|
64
|
+
str = sym.to_s
|
65
|
+
if str != str.camelize.underscore
|
66
|
+
raise ArgumentError.new("Only keys satisfying `key.to_s == key.to_s.caamelize.underscore` can be used.")
|
67
|
+
end
|
68
|
+
end
|
60
69
|
end
|
61
70
|
end
|
62
71
|
end
|
@@ -14,7 +14,8 @@ module Camille
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def check value
|
17
|
-
|
17
|
+
transformed = value.is_a?(Symbol) ? value.to_s : value
|
18
|
+
unless transformed == @value
|
18
19
|
Camille::TypeError.new("Expected string literal #{@value.inspect}, got #{value.inspect}.")
|
19
20
|
end
|
20
21
|
end
|
data/lib/camille/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camille
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 辻彩
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|