moonlogs-ruby 0.0.1.pre.rc
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +524 -0
- data/Rakefile +8 -0
- data/docs/ApiToken.md +10 -0
- data/docs/Credentials.md +8 -0
- data/docs/DefaultApi.md +1318 -0
- data/docs/InlineResponse200.md +11 -0
- data/docs/InlineResponse2001.md +11 -0
- data/docs/InlineResponse20010.md +11 -0
- data/docs/InlineResponse20011.md +11 -0
- data/docs/InlineResponse20012.md +11 -0
- data/docs/InlineResponse20013.md +11 -0
- data/docs/InlineResponse2002.md +11 -0
- data/docs/InlineResponse2003.md +11 -0
- data/docs/InlineResponse2004.md +11 -0
- data/docs/InlineResponse2005.md +11 -0
- data/docs/InlineResponse2006.md +11 -0
- data/docs/InlineResponse2007.md +11 -0
- data/docs/InlineResponse2008.md +11 -0
- data/docs/InlineResponse2009.md +11 -0
- data/docs/Level.md +6 -0
- data/docs/Meta.md +9 -0
- data/docs/OneOfRecordLevel.md +6 -0
- data/docs/OneOfUserRole.md +6 -0
- data/docs/Record.md +15 -0
- data/docs/Role.md +6 -0
- data/docs/Schema.md +14 -0
- data/docs/SchemaField.md +8 -0
- data/docs/SchemaKind.md +8 -0
- data/docs/SchemaSearch.md +8 -0
- data/docs/Session.md +7 -0
- data/docs/Tag.md +8 -0
- data/docs/User.md +14 -0
- data/git_push.sh +55 -0
- data/lib/moonlogs-ruby/api/default_api.rb +1458 -0
- data/lib/moonlogs-ruby/api_client.rb +388 -0
- data/lib/moonlogs-ruby/api_error.rb +57 -0
- data/lib/moonlogs-ruby/configuration.rb +205 -0
- data/lib/moonlogs-ruby/models/api_token.rb +253 -0
- data/lib/moonlogs-ruby/models/credentials.rb +225 -0
- data/lib/moonlogs-ruby/models/inline_response_200.rb +269 -0
- data/lib/moonlogs-ruby/models/inline_response_200_1.rb +267 -0
- data/lib/moonlogs-ruby/models/inline_response_200_10.rb +267 -0
- data/lib/moonlogs-ruby/models/inline_response_200_11.rb +267 -0
- data/lib/moonlogs-ruby/models/inline_response_200_12.rb +269 -0
- data/lib/moonlogs-ruby/models/inline_response_200_13.rb +267 -0
- data/lib/moonlogs-ruby/models/inline_response_200_2.rb +267 -0
- data/lib/moonlogs-ruby/models/inline_response_200_3.rb +269 -0
- data/lib/moonlogs-ruby/models/inline_response_200_4.rb +267 -0
- data/lib/moonlogs-ruby/models/inline_response_200_5.rb +269 -0
- data/lib/moonlogs-ruby/models/inline_response_200_6.rb +267 -0
- data/lib/moonlogs-ruby/models/inline_response_200_7.rb +268 -0
- data/lib/moonlogs-ruby/models/inline_response_200_8.rb +267 -0
- data/lib/moonlogs-ruby/models/inline_response_200_9.rb +269 -0
- data/lib/moonlogs-ruby/models/level.rb +32 -0
- data/lib/moonlogs-ruby/models/meta.rb +239 -0
- data/lib/moonlogs-ruby/models/one_of_record_level.rb +197 -0
- data/lib/moonlogs-ruby/models/one_of_user_role.rb +197 -0
- data/lib/moonlogs-ruby/models/record.rb +303 -0
- data/lib/moonlogs-ruby/models/role.rb +28 -0
- data/lib/moonlogs-ruby/models/schema.rb +298 -0
- data/lib/moonlogs-ruby/models/schema_field.rb +225 -0
- data/lib/moonlogs-ruby/models/schema_kind.rb +225 -0
- data/lib/moonlogs-ruby/models/schema_search.rb +215 -0
- data/lib/moonlogs-ruby/models/session.rb +211 -0
- data/lib/moonlogs-ruby/models/tag.rb +225 -0
- data/lib/moonlogs-ruby/models/user.rb +301 -0
- data/lib/moonlogs-ruby/version.rb +14 -0
- data/lib/moonlogs-ruby.rb +68 -0
- data/moonlogs-ruby-0.0.1.0.gem +0 -0
- data/moonlogs-ruby-0.0.1.gem +0 -0
- data/moonlogs-ruby.gemspec +38 -0
- data/spec/api/default_api_spec.rb +317 -0
- data/spec/api_client_spec.rb +225 -0
- data/spec/base_object_spec.rb +109 -0
- data/spec/configuration_spec.rb +41 -0
- data/spec/models/api_token_spec.rb +58 -0
- data/spec/models/credentials_spec.rb +46 -0
- data/spec/models/inline_response_200_10_spec.rb +64 -0
- data/spec/models/inline_response_200_11_spec.rb +64 -0
- data/spec/models/inline_response_200_12_spec.rb +64 -0
- data/spec/models/inline_response_200_13_spec.rb +64 -0
- data/spec/models/inline_response_200_1_spec.rb +64 -0
- data/spec/models/inline_response_200_2_spec.rb +64 -0
- data/spec/models/inline_response_200_3_spec.rb +64 -0
- data/spec/models/inline_response_200_4_spec.rb +64 -0
- data/spec/models/inline_response_200_5_spec.rb +64 -0
- data/spec/models/inline_response_200_6_spec.rb +64 -0
- data/spec/models/inline_response_200_7_spec.rb +64 -0
- data/spec/models/inline_response_200_8_spec.rb +64 -0
- data/spec/models/inline_response_200_9_spec.rb +64 -0
- data/spec/models/inline_response_200_spec.rb +64 -0
- data/spec/models/level_spec.rb +34 -0
- data/spec/models/meta_spec.rb +52 -0
- data/spec/models/one_of_record_level_spec.rb +34 -0
- data/spec/models/one_of_user_role_spec.rb +34 -0
- data/spec/models/record_spec.rb +88 -0
- data/spec/models/role_spec.rb +34 -0
- data/spec/models/schema_field_spec.rb +46 -0
- data/spec/models/schema_kind_spec.rb +46 -0
- data/spec/models/schema_search_spec.rb +46 -0
- data/spec/models/schema_spec.rb +82 -0
- data/spec/models/session_spec.rb +40 -0
- data/spec/models/tag_spec.rb +46 -0
- data/spec/models/user_spec.rb +82 -0
- data/spec/spec_helper.rb +110 -0
- metadata +243 -0
@@ -0,0 +1,317 @@
|
|
1
|
+
=begin
|
2
|
+
#Moonlogs
|
3
|
+
|
4
|
+
#Moonlogs API
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.0.1
|
7
|
+
Contact: shalpack@gmail.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.52
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
require 'json'
|
14
|
+
|
15
|
+
# Unit tests for MoonlogsRuby::DefaultApi
|
16
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
17
|
+
# Please update as you see appropriate
|
18
|
+
describe 'DefaultApi' do
|
19
|
+
before do
|
20
|
+
# run before each test
|
21
|
+
@instance = MoonlogsRuby::DefaultApi.new
|
22
|
+
end
|
23
|
+
|
24
|
+
after do
|
25
|
+
# run after each test
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'test an instance of DefaultApi' do
|
29
|
+
it 'should create an instance of DefaultApi' do
|
30
|
+
expect(@instance).to be_instance_of(MoonlogsRuby::DefaultApi)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# unit tests for api_api_tokens_get
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [InlineResponse2009]
|
37
|
+
describe 'api_api_tokens_get test' do
|
38
|
+
it 'should work' do
|
39
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# unit tests for api_api_tokens_id_delete
|
44
|
+
# @param id
|
45
|
+
# @param [Hash] opts the optional parameters
|
46
|
+
# @return [InlineResponse20011]
|
47
|
+
describe 'api_api_tokens_id_delete test' do
|
48
|
+
it 'should work' do
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# unit tests for api_api_tokens_id_get
|
54
|
+
# @param id
|
55
|
+
# @param [Hash] opts the optional parameters
|
56
|
+
# @return [InlineResponse20010]
|
57
|
+
describe 'api_api_tokens_id_get test' do
|
58
|
+
it 'should work' do
|
59
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# unit tests for api_api_tokens_id_put
|
64
|
+
# @param id
|
65
|
+
# @param [Hash] opts the optional parameters
|
66
|
+
# @option opts [ApiToken] :body
|
67
|
+
# @return [InlineResponse20010]
|
68
|
+
describe 'api_api_tokens_id_put test' do
|
69
|
+
it 'should work' do
|
70
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# unit tests for api_api_tokens_post
|
75
|
+
# @param [Hash] opts the optional parameters
|
76
|
+
# @option opts [ApiToken] :body
|
77
|
+
# @return [InlineResponse20010]
|
78
|
+
describe 'api_api_tokens_post test' do
|
79
|
+
it 'should work' do
|
80
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# unit tests for api_logs_get
|
85
|
+
# @param [Hash] opts the optional parameters
|
86
|
+
# @option opts [Integer] :page
|
87
|
+
# @option opts [Integer] :limit
|
88
|
+
# @return [InlineResponse2003]
|
89
|
+
describe 'api_logs_get test' do
|
90
|
+
it 'should work' do
|
91
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# unit tests for api_logs_group_schema_name_hash_get
|
96
|
+
# @param schema_name
|
97
|
+
# @param hash
|
98
|
+
# @param [Hash] opts the optional parameters
|
99
|
+
# @return [InlineResponse2003]
|
100
|
+
describe 'api_logs_group_schema_name_hash_get test' do
|
101
|
+
it 'should work' do
|
102
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# unit tests for api_logs_id_get
|
107
|
+
# @param id
|
108
|
+
# @param [Hash] opts the optional parameters
|
109
|
+
# @return [InlineResponse2004]
|
110
|
+
describe 'api_logs_id_get test' do
|
111
|
+
it 'should work' do
|
112
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# unit tests for api_logs_post
|
117
|
+
# @param [Hash] opts the optional parameters
|
118
|
+
# @option opts [Record] :body
|
119
|
+
# @return [InlineResponse2004]
|
120
|
+
describe 'api_logs_post test' do
|
121
|
+
it 'should work' do
|
122
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# unit tests for api_logs_search_post
|
127
|
+
# @param [Hash] opts the optional parameters
|
128
|
+
# @option opts [Record] :body
|
129
|
+
# @option opts [Integer] :page
|
130
|
+
# @option opts [Integer] :limit
|
131
|
+
# @return [InlineResponse2003]
|
132
|
+
describe 'api_logs_search_post test' do
|
133
|
+
it 'should work' do
|
134
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
# unit tests for api_schemas_get
|
139
|
+
# @param [Hash] opts the optional parameters
|
140
|
+
# @return [InlineResponse200]
|
141
|
+
describe 'api_schemas_get test' do
|
142
|
+
it 'should work' do
|
143
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# unit tests for api_schemas_id_delete
|
148
|
+
# @param id
|
149
|
+
# @param [Hash] opts the optional parameters
|
150
|
+
# @return [InlineResponse2002]
|
151
|
+
describe 'api_schemas_id_delete test' do
|
152
|
+
it 'should work' do
|
153
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
# unit tests for api_schemas_id_get
|
158
|
+
# @param id
|
159
|
+
# @param [Hash] opts the optional parameters
|
160
|
+
# @return [InlineResponse2001]
|
161
|
+
describe 'api_schemas_id_get test' do
|
162
|
+
it 'should work' do
|
163
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# unit tests for api_schemas_id_put
|
168
|
+
# @param id
|
169
|
+
# @param [Hash] opts the optional parameters
|
170
|
+
# @option opts [Schema] :body
|
171
|
+
# @return [InlineResponse2001]
|
172
|
+
describe 'api_schemas_id_put test' do
|
173
|
+
it 'should work' do
|
174
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# unit tests for api_schemas_post
|
179
|
+
# @param [Hash] opts the optional parameters
|
180
|
+
# @option opts [Schema] :body
|
181
|
+
# @return [InlineResponse2001]
|
182
|
+
describe 'api_schemas_post test' do
|
183
|
+
it 'should work' do
|
184
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
# unit tests for api_session_get
|
189
|
+
# @param [Hash] opts the optional parameters
|
190
|
+
# @return [InlineResponse2008]
|
191
|
+
describe 'api_session_get test' do
|
192
|
+
it 'should work' do
|
193
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
# unit tests for api_session_post
|
198
|
+
# @param [Hash] opts the optional parameters
|
199
|
+
# @option opts [Credentials] :body
|
200
|
+
# @return [InlineResponse2008]
|
201
|
+
describe 'api_session_post test' do
|
202
|
+
it 'should work' do
|
203
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# unit tests for api_setup_register_admin_post
|
208
|
+
# @param [Hash] opts the optional parameters
|
209
|
+
# @option opts [User] :body
|
210
|
+
# @return [User]
|
211
|
+
describe 'api_setup_register_admin_post test' do
|
212
|
+
it 'should work' do
|
213
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
# unit tests for api_tags_get
|
218
|
+
# @param [Hash] opts the optional parameters
|
219
|
+
# @return [InlineResponse20012]
|
220
|
+
describe 'api_tags_get test' do
|
221
|
+
it 'should work' do
|
222
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
# unit tests for api_tags_id_delete
|
227
|
+
# @param id
|
228
|
+
# @param [Hash] opts the optional parameters
|
229
|
+
# @return [InlineResponse20011]
|
230
|
+
describe 'api_tags_id_delete test' do
|
231
|
+
it 'should work' do
|
232
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
# unit tests for api_tags_id_get
|
237
|
+
# @param id
|
238
|
+
# @param [Hash] opts the optional parameters
|
239
|
+
# @return [InlineResponse20013]
|
240
|
+
describe 'api_tags_id_get test' do
|
241
|
+
it 'should work' do
|
242
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
# unit tests for api_tags_id_put
|
247
|
+
# @param id
|
248
|
+
# @param [Hash] opts the optional parameters
|
249
|
+
# @option opts [Tag] :body
|
250
|
+
# @return [InlineResponse20013]
|
251
|
+
describe 'api_tags_id_put test' do
|
252
|
+
it 'should work' do
|
253
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
# unit tests for api_tags_post
|
258
|
+
# @param [Hash] opts the optional parameters
|
259
|
+
# @option opts [Tag] :body
|
260
|
+
# @return [InlineResponse20013]
|
261
|
+
describe 'api_tags_post test' do
|
262
|
+
it 'should work' do
|
263
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
# unit tests for api_users_get
|
268
|
+
# @param [Hash] opts the optional parameters
|
269
|
+
# @return [InlineResponse2005]
|
270
|
+
describe 'api_users_get test' do
|
271
|
+
it 'should work' do
|
272
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
# unit tests for api_users_id_delete
|
277
|
+
# @param id
|
278
|
+
# @param [Hash] opts the optional parameters
|
279
|
+
# @return [InlineResponse2007]
|
280
|
+
describe 'api_users_id_delete test' do
|
281
|
+
it 'should work' do
|
282
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
# unit tests for api_users_id_get
|
287
|
+
# @param id
|
288
|
+
# @param [Hash] opts the optional parameters
|
289
|
+
# @return [InlineResponse2006]
|
290
|
+
describe 'api_users_id_get test' do
|
291
|
+
it 'should work' do
|
292
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
# unit tests for api_users_id_put
|
297
|
+
# @param id
|
298
|
+
# @param [Hash] opts the optional parameters
|
299
|
+
# @option opts [User] :body
|
300
|
+
# @return [InlineResponse2006]
|
301
|
+
describe 'api_users_id_put test' do
|
302
|
+
it 'should work' do
|
303
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
# unit tests for api_users_post
|
308
|
+
# @param [Hash] opts the optional parameters
|
309
|
+
# @option opts [User] :body
|
310
|
+
# @return [InlineResponse2006]
|
311
|
+
describe 'api_users_post test' do
|
312
|
+
it 'should work' do
|
313
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
end
|
@@ -0,0 +1,225 @@
|
|
1
|
+
=begin
|
2
|
+
#Moonlogs
|
3
|
+
|
4
|
+
#Moonlogs API
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.0.1
|
7
|
+
Contact: shalpack@gmail.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.52
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
|
14
|
+
describe MoonlogsRuby::ApiClient do
|
15
|
+
context 'initialization' do
|
16
|
+
context 'URL stuff' do
|
17
|
+
context 'host' do
|
18
|
+
it 'removes http from host' do
|
19
|
+
MoonlogsRuby.configure { |c| c.host = 'http://example.com' }
|
20
|
+
expect(MoonlogsRuby::Configuration.default.host).to eq('example.com')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'removes https from host' do
|
24
|
+
MoonlogsRuby.configure { |c| c.host = 'https://wookiee.com' }
|
25
|
+
expect(MoonlogsRuby::ApiClient.default.config.host).to eq('wookiee.com')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'removes trailing path from host' do
|
29
|
+
MoonlogsRuby.configure { |c| c.host = 'hobo.com/v4' }
|
30
|
+
expect(MoonlogsRuby::Configuration.default.host).to eq('hobo.com')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'base_path' do
|
35
|
+
it "prepends a slash to base_path" do
|
36
|
+
MoonlogsRuby.configure { |c| c.base_path = 'v4/dog' }
|
37
|
+
expect(MoonlogsRuby::Configuration.default.base_path).to eq('/v4/dog')
|
38
|
+
end
|
39
|
+
|
40
|
+
it "doesn't prepend a slash if one is already there" do
|
41
|
+
MoonlogsRuby.configure { |c| c.base_path = '/v4/dog' }
|
42
|
+
expect(MoonlogsRuby::Configuration.default.base_path).to eq('/v4/dog')
|
43
|
+
end
|
44
|
+
|
45
|
+
it "ends up as a blank string if nil" do
|
46
|
+
MoonlogsRuby.configure { |c| c.base_path = nil }
|
47
|
+
expect(MoonlogsRuby::Configuration.default.base_path).to eq('')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'params_encoding in #build_request' do
|
54
|
+
let(:config) { MoonlogsRuby::Configuration.new }
|
55
|
+
let(:api_client) { MoonlogsRuby::ApiClient.new(config) }
|
56
|
+
|
57
|
+
it 'defaults to nil' do
|
58
|
+
expect(MoonlogsRuby::Configuration.default.params_encoding).to eq(nil)
|
59
|
+
expect(config.params_encoding).to eq(nil)
|
60
|
+
|
61
|
+
request = api_client.build_request(:get, '/test')
|
62
|
+
expect(request.options[:params_encoding]).to eq(nil)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'can be customized' do
|
66
|
+
config.params_encoding = :multi
|
67
|
+
request = api_client.build_request(:get, '/test')
|
68
|
+
expect(request.options[:params_encoding]).to eq(:multi)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe 'timeout in #build_request' do
|
73
|
+
let(:config) { MoonlogsRuby::Configuration.new }
|
74
|
+
let(:api_client) { MoonlogsRuby::ApiClient.new(config) }
|
75
|
+
|
76
|
+
it 'defaults to 0' do
|
77
|
+
expect(MoonlogsRuby::Configuration.default.timeout).to eq(0)
|
78
|
+
expect(config.timeout).to eq(0)
|
79
|
+
|
80
|
+
request = api_client.build_request(:get, '/test')
|
81
|
+
expect(request.options[:timeout]).to eq(0)
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'can be customized' do
|
85
|
+
config.timeout = 100
|
86
|
+
request = api_client.build_request(:get, '/test')
|
87
|
+
expect(request.options[:timeout]).to eq(100)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe '#deserialize' do
|
92
|
+
it "handles Array<Integer>" do
|
93
|
+
api_client = MoonlogsRuby::ApiClient.new
|
94
|
+
headers = { 'Content-Type' => 'application/json' }
|
95
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
96
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
97
|
+
expect(data).to be_instance_of(Array)
|
98
|
+
expect(data).to eq([12, 34])
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'handles Array<Array<Integer>>' do
|
102
|
+
api_client = MoonlogsRuby::ApiClient.new
|
103
|
+
headers = { 'Content-Type' => 'application/json' }
|
104
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
105
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
106
|
+
expect(data).to be_instance_of(Array)
|
107
|
+
expect(data).to eq([[12, 34], [56]])
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'handles Hash<String, String>' do
|
111
|
+
api_client = MoonlogsRuby::ApiClient.new
|
112
|
+
headers = { 'Content-Type' => 'application/json' }
|
113
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
114
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
115
|
+
expect(data).to be_instance_of(Hash)
|
116
|
+
expect(data).to eq(:message => 'Hello')
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe "#object_to_hash" do
|
121
|
+
it 'ignores nils and includes empty arrays' do
|
122
|
+
# uncomment below to test object_to_hash for model
|
123
|
+
# api_client = MoonlogsRuby::ApiClient.new
|
124
|
+
# _model = MoonlogsRuby::ModelName.new
|
125
|
+
# update the model attribute below
|
126
|
+
# _model.id = 1
|
127
|
+
# update the expected value (hash) below
|
128
|
+
# expected = {id: 1, name: '', tags: []}
|
129
|
+
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
describe '#build_collection_param' do
|
134
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
135
|
+
let(:api_client) { MoonlogsRuby::ApiClient.new }
|
136
|
+
|
137
|
+
it 'works for csv' do
|
138
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'works for ssv' do
|
142
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'works for tsv' do
|
146
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'works for pipes' do
|
150
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'works for multi' do
|
154
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'fails for invalid collection format' do
|
158
|
+
expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
describe '#json_mime?' do
|
163
|
+
let(:api_client) { MoonlogsRuby::ApiClient.new }
|
164
|
+
|
165
|
+
it 'works' do
|
166
|
+
expect(api_client.json_mime?(nil)).to eq false
|
167
|
+
expect(api_client.json_mime?('')).to eq false
|
168
|
+
|
169
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
170
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
171
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
172
|
+
|
173
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
174
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
175
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
describe '#select_header_accept' do
|
180
|
+
let(:api_client) { MoonlogsRuby::ApiClient.new }
|
181
|
+
|
182
|
+
it 'works' do
|
183
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
184
|
+
expect(api_client.select_header_accept([])).to be_nil
|
185
|
+
|
186
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
187
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
188
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
189
|
+
|
190
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
191
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
describe '#select_header_content_type' do
|
196
|
+
let(:api_client) { MoonlogsRuby::ApiClient.new }
|
197
|
+
|
198
|
+
it 'works' do
|
199
|
+
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
200
|
+
expect(api_client.select_header_content_type([])).to eq('application/json')
|
201
|
+
|
202
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
203
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
204
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
205
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
206
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
describe '#sanitize_filename' do
|
211
|
+
let(:api_client) { MoonlogsRuby::ApiClient.new }
|
212
|
+
|
213
|
+
it 'works' do
|
214
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
215
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
216
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
217
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
218
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
219
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
220
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
221
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
222
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class ArrayMapObject < Petstore::Category
|
4
|
+
attr_accessor :int_arr, :pet_arr, :int_map, :pet_map, :int_arr_map, :pet_arr_map, :boolean_true_arr, :boolean_false_arr
|
5
|
+
|
6
|
+
def self.attribute_map
|
7
|
+
{
|
8
|
+
:int_arr => :int_arr,
|
9
|
+
:pet_arr => :pet_arr,
|
10
|
+
:int_map => :int_map,
|
11
|
+
:pet_map => :pet_map,
|
12
|
+
:int_arr_map => :int_arr_map,
|
13
|
+
:pet_arr_map => :pet_arr_map,
|
14
|
+
:boolean_true_arr => :boolean_true_arr,
|
15
|
+
:boolean_false_arr => :boolean_false_arr,
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.swagger_types
|
20
|
+
{
|
21
|
+
:int_arr => :'Array<Integer>',
|
22
|
+
:pet_arr => :'Array<Pet>',
|
23
|
+
:int_map => :'Hash<String, Integer>',
|
24
|
+
:pet_map => :'Hash<String, Pet>',
|
25
|
+
:int_arr_map => :'Hash<String, Array<Integer>>',
|
26
|
+
:pet_arr_map => :'Hash<String, Array<Pet>>',
|
27
|
+
:boolean_true_arr => :'Array<BOOLEAN>',
|
28
|
+
:boolean_false_arr => :'Array<BOOLEAN>',
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'BaseObject' do
|
34
|
+
describe 'boolean values' do
|
35
|
+
let(:obj) { Petstore::Cat.new({declawed: false}) }
|
36
|
+
|
37
|
+
it 'should have values set' do
|
38
|
+
expect(obj.declawed).not_to be_nil
|
39
|
+
expect(obj.declawed).to eq(false)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'array and map properties' do
|
44
|
+
let(:obj) { ArrayMapObject.new }
|
45
|
+
|
46
|
+
let(:data) do
|
47
|
+
{int_arr: [123, 456],
|
48
|
+
pet_arr: [{name: 'Kitty'}],
|
49
|
+
int_map: {'int' => 123},
|
50
|
+
pet_map: {'pet' => {name: 'Kitty'}},
|
51
|
+
int_arr_map: {'int_arr' => [123, 456]},
|
52
|
+
pet_arr_map: {'pet_arr' => [{name: 'Kitty'}]},
|
53
|
+
boolean_true_arr: [true, "true", "TruE", 1, "y", "yes", "1", "t", "T"],
|
54
|
+
boolean_false_arr: [false, "", 0, "0", "f", nil, "null"],
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'works for #build_from_hash' do
|
59
|
+
obj.build_from_hash(data)
|
60
|
+
|
61
|
+
expect(obj.int_arr).to match_array([123, 456])
|
62
|
+
|
63
|
+
expect(obj.pet_arr).to be_instance_of(Array)
|
64
|
+
expect(obj.pet_arr).to be_instance_of(1)
|
65
|
+
|
66
|
+
pet = obj.pet_arr.first
|
67
|
+
expect(pet).to be_instance_of(Petstore::Pet)
|
68
|
+
expect(pet.name).to eq('Kitty')
|
69
|
+
|
70
|
+
expect(obj.int_map).to be_instance_of(Hash)
|
71
|
+
expect(obj.int_map).to eq({'int' => 123})
|
72
|
+
|
73
|
+
expect(obj.pet_map).to be_instance_of(Hash)
|
74
|
+
pet = obj.pet_map['pet']
|
75
|
+
expect(pet).to be_instance_of(Petstore::Pet)
|
76
|
+
expect(pet.name).to eq('Kitty')
|
77
|
+
|
78
|
+
expect(obj.int_arr_map).to be_instance_of(Hash)
|
79
|
+
arr = obj.int_arr_map['int_arr']
|
80
|
+
expect(arr).to match_array([123, 456])
|
81
|
+
|
82
|
+
expect(obj.pet_arr_map).to be_instance_of(Hash)
|
83
|
+
arr = obj.pet_arr_map['pet_arr']
|
84
|
+
expect(arr).to be_instance_of(Array)
|
85
|
+
expect(arr.size).to eq(1)
|
86
|
+
pet = arr.first
|
87
|
+
expect(pet).to be_instance_of(Petstore::Pet)
|
88
|
+
expect(pet.name).to eq('Kitty')
|
89
|
+
|
90
|
+
expect(obj.boolean_true_arr).to be_instance_of(Array)
|
91
|
+
obj.boolean_true_arr.each do |b|
|
92
|
+
expect(b).to eq(true)
|
93
|
+
end
|
94
|
+
|
95
|
+
expect(obj.boolean_false_arr).to be_instance_of(Array)
|
96
|
+
obj.boolean_false_arr.each do |b|
|
97
|
+
expect(b).to eq(false)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'works for #to_hash' do
|
102
|
+
obj.build_from_hash(data)
|
103
|
+
expect_data = data.dup
|
104
|
+
expect_data[:boolean_true_arr].map! {true}
|
105
|
+
expect_data[:boolean_false_arr].map! {false}
|
106
|
+
expect(obj.to_hash).to eq(expect_data)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
=begin
|
2
|
+
#Moonlogs
|
3
|
+
|
4
|
+
#Moonlogs API
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.0.1
|
7
|
+
Contact: shalpack@gmail.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 3.0.52
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
|
14
|
+
describe MoonlogsRuby::Configuration do
|
15
|
+
let(:config) { MoonlogsRuby::Configuration.default }
|
16
|
+
|
17
|
+
before(:each) do
|
18
|
+
# uncomment below to setup host and base_path
|
19
|
+
# require 'URI'
|
20
|
+
# uri = URI.parse("/")
|
21
|
+
# MoonlogsRuby.configure do |c|
|
22
|
+
# c.host = uri.host
|
23
|
+
# c.base_path = uri.path
|
24
|
+
# end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#base_url' do
|
28
|
+
it 'should have the default value' do
|
29
|
+
# uncomment below to test default value of the base path
|
30
|
+
# expect(config.base_url).to eq("/")
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should remove trailing slashes' do
|
34
|
+
[nil, '', '/', '//'].each do |base_path|
|
35
|
+
config.base_path = base_path
|
36
|
+
# uncomment below to test trailing slashes
|
37
|
+
# expect(config.base_url).to eq("/")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|