apipie-bindings 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/release_notes.md +3 -0
- data/lib/apipie_bindings/api.rb +2 -2
- data/lib/apipie_bindings/rest_client_extensions.rb +1 -1
- data/lib/apipie_bindings/route.rb +2 -2
- data/lib/apipie_bindings/version.rb +1 -1
- data/test/unit/action_test.rb +6 -6
- data/test/unit/api_test.rb +1 -1
- data/test/unit/param_test.rb +1 -1
- data/test/unit/resource_test.rb +1 -1
- data/test/unit/route_test.rb +1 -1
- data/test/unit/test_helper.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c27168a737308891f84a0437f14b21247d4054651f698f888ef3a5e80dced00
|
4
|
+
data.tar.gz: 6d68349f382e9282d5674db0e175280d05952ea35004a6dc525d896b93ae46c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeb6522be945abe8c90588ac382751e4cf0ece7b898ae233def0a73d9d621264ee5bb4494e5da4921a75cde2af8fe078be3aa4875441e54390417b9948ff75b5
|
7
|
+
data.tar.gz: 1ac904b2c5e2ea670246619fe8d1e5b3450cc7567f716692506311e0ce5a0130191862e71e9ef253fcb87437a88fa9213ab3e93b57a902f7d0f6c056c2c18f04
|
data/doc/release_notes.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
Release notes
|
2
2
|
=============
|
3
|
+
### 0.4.0 (2020-05-29)
|
4
|
+
* support Ruby 2.7 ([PR #79](https://github.com/Apipie/apipie-bindings/pull/79))
|
5
|
+
|
3
6
|
### 0.3.0 (2019-10-25)
|
4
7
|
* Add token based auth mechanism ([PR #77](https://github.com/Apipie/apipie-bindings/pull/77))
|
5
8
|
* Throw malformed examples ([PR #78](https://github.com/Apipie/apipie-bindings/pull/78))
|
data/lib/apipie_bindings/api.rb
CHANGED
@@ -135,7 +135,7 @@ module ApipieBindings
|
|
135
135
|
end
|
136
136
|
|
137
137
|
def apidoc
|
138
|
-
@apidoc
|
138
|
+
@apidoc ||= load_apidoc || retrieve_apidoc
|
139
139
|
@apidoc
|
140
140
|
end
|
141
141
|
|
@@ -280,7 +280,7 @@ module ApipieBindings
|
|
280
280
|
end
|
281
281
|
|
282
282
|
def retrieve_apidoc
|
283
|
-
FileUtils.mkdir_p(@apidoc_cache_dir) unless File.
|
283
|
+
FileUtils.mkdir_p(@apidoc_cache_dir) unless File.exist?(@apidoc_cache_dir)
|
284
284
|
if language
|
285
285
|
response = retrieve_apidoc_call("/apidoc/v#{@api_version}.#{language}.json", :safe => true)
|
286
286
|
language_family = language.split('_').first
|
@@ -16,7 +16,7 @@ module ApipieBindings
|
|
16
16
|
end
|
17
17
|
|
18
18
|
unless RestClient.before_execution_procs.include? RestClient::AUTHENTICATOR_EXTENSION
|
19
|
-
RestClient.add_before_execution_proc
|
19
|
+
RestClient.add_before_execution_proc(&RestClient::AUTHENTICATOR_EXTENSION)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -17,10 +17,10 @@ module ApipieBindings
|
|
17
17
|
def path(params=nil)
|
18
18
|
return @path if params.nil?
|
19
19
|
|
20
|
-
|
20
|
+
params_in_path.inject(@path) do |p, param_name|
|
21
21
|
param_value = (params[param_name.to_sym] or params[param_name.to_s]) or
|
22
22
|
raise ArgumentError, "missing param '#{param_name}' in parameters"
|
23
|
-
p.sub(":#{param_name}",
|
23
|
+
p.sub(":#{param_name}", CGI.escape(param_value.to_s))
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
data/test/unit/action_test.rb
CHANGED
@@ -60,7 +60,7 @@ describe ApipieBindings::Action do
|
|
60
60
|
e = proc do
|
61
61
|
resource.action(:create).validate!({ :user => { :vip => true } })
|
62
62
|
end.must_raise(ApipieBindings::MissingArgumentsError)
|
63
|
-
e.message.must_match
|
63
|
+
e.message.must_match(/: user\[name\]$/)
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should raise on missing nested required params (hash)" do
|
@@ -74,7 +74,7 @@ describe ApipieBindings::Action do
|
|
74
74
|
}
|
75
75
|
})
|
76
76
|
end.must_raise(ApipieBindings::MissingArgumentsError)
|
77
|
-
e.message.must_match
|
77
|
+
e.message.must_match(/: user\[address\]\[city\]$/)
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should raise on missing nested required params (array)" do
|
@@ -88,7 +88,7 @@ describe ApipieBindings::Action do
|
|
88
88
|
}
|
89
89
|
})
|
90
90
|
end.must_raise(ApipieBindings::MissingArgumentsError)
|
91
|
-
e.message.must_match
|
91
|
+
e.message.must_match(/: user\[contacts\]\[0\]\[contact\]$/)
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should raise on invalid param format" do
|
@@ -103,8 +103,8 @@ describe ApipieBindings::Action do
|
|
103
103
|
}
|
104
104
|
})
|
105
105
|
end.must_raise(ApipieBindings::InvalidArgumentTypesError)
|
106
|
-
e.message.must_match
|
107
|
-
e.message.must_match
|
106
|
+
e.message.must_match(/user\[contacts\]\[0\] - Hash was expected/)
|
107
|
+
e.message.must_match(/user\[contacts\]\[1\] - Hash was expected/)
|
108
108
|
end
|
109
109
|
|
110
110
|
it "should accept minimal correct params" do
|
@@ -131,7 +131,7 @@ describe ApipieBindings::Action do
|
|
131
131
|
end
|
132
132
|
|
133
133
|
it "should have name visible in puts" do
|
134
|
-
out,
|
134
|
+
out, _err = capture_io { puts resource.action(:index) }
|
135
135
|
out.must_equal "<Action users:index>\n"
|
136
136
|
end
|
137
137
|
|
data/test/unit/api_test.rb
CHANGED
@@ -76,7 +76,7 @@ describe ApipieBindings::API do
|
|
76
76
|
request_args = RestClient.version >= '1.8.0' ? args.last.args : args.last
|
77
77
|
request_args[:method] == :post && request_args[:params] == {:file => s} && request_args[:headers] == headers
|
78
78
|
end
|
79
|
-
|
79
|
+
api.http_call(:post, '/api/path', {:file => s}, headers, {:response => :raw})
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should process nil response safely" do
|
data/test/unit/param_test.rb
CHANGED
data/test/unit/resource_test.rb
CHANGED
data/test/unit/route_test.rb
CHANGED
data/test/unit/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apipie-bindings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Bačovský
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -62,16 +62,16 @@ dependencies:
|
|
62
62
|
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: 12.3.3
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- - "
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
74
|
+
version: 12.3.3
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: thor
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -257,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
257
|
version: '0'
|
258
258
|
requirements: []
|
259
259
|
rubyforge_project:
|
260
|
-
rubygems_version: 2.7.
|
260
|
+
rubygems_version: 2.7.6.2
|
261
261
|
signing_key:
|
262
262
|
specification_version: 4
|
263
263
|
summary: The Ruby bindings for Apipie documented APIs
|