pokeapi_client 0.10.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +27 -25
  3. data/README.md +7 -6
  4. data/bin/bundle +5 -10
  5. data/bin/byebug +1 -1
  6. data/bin/coderay +1 -1
  7. data/bin/htmldiff +1 -1
  8. data/bin/ldiff +1 -1
  9. data/bin/pry +1 -1
  10. data/bin/racc +27 -0
  11. data/bin/rake +1 -1
  12. data/bin/rspec +1 -1
  13. data/bin/rubocop +1 -1
  14. data/bin/ruby-parse +1 -1
  15. data/bin/ruby-rewrite +1 -1
  16. data/lib/pokeapi_client/api/ability_api.rb +2 -2
  17. data/lib/pokeapi_client/api/berry_api.rb +2 -2
  18. data/lib/pokeapi_client/api/berry_firmness_api.rb +2 -2
  19. data/lib/pokeapi_client/api/berry_flavor_api.rb +2 -2
  20. data/lib/pokeapi_client/api/characteristic_api.rb +2 -2
  21. data/lib/pokeapi_client/api/contest_effect_api.rb +2 -2
  22. data/lib/pokeapi_client/api/contest_type_api.rb +2 -2
  23. data/lib/pokeapi_client/api/egg_group_api.rb +2 -2
  24. data/lib/pokeapi_client/api/encounter_condition_api.rb +2 -2
  25. data/lib/pokeapi_client/api/encounter_condition_value_api.rb +2 -2
  26. data/lib/pokeapi_client/api/encounter_method_api.rb +2 -2
  27. data/lib/pokeapi_client/api/evolution_chain_api.rb +2 -2
  28. data/lib/pokeapi_client/api/evolution_trigger_api.rb +2 -2
  29. data/lib/pokeapi_client/api/gender_api.rb +2 -2
  30. data/lib/pokeapi_client/api/generation_api.rb +2 -2
  31. data/lib/pokeapi_client/api/growth_rate_api.rb +2 -2
  32. data/lib/pokeapi_client/api/item_api.rb +2 -2
  33. data/lib/pokeapi_client/api/item_attribute_api.rb +2 -2
  34. data/lib/pokeapi_client/api/item_category_api.rb +2 -2
  35. data/lib/pokeapi_client/api/item_fling_effect_api.rb +2 -2
  36. data/lib/pokeapi_client/api/item_pocket_api.rb +2 -2
  37. data/lib/pokeapi_client/api/language_api.rb +2 -2
  38. data/lib/pokeapi_client/api/location_api.rb +2 -2
  39. data/lib/pokeapi_client/api/location_area_api.rb +2 -2
  40. data/lib/pokeapi_client/api/machine_api.rb +2 -2
  41. data/lib/pokeapi_client/api/move_ailment_api.rb +2 -2
  42. data/lib/pokeapi_client/api/move_api.rb +2 -2
  43. data/lib/pokeapi_client/api/move_battle_style_api.rb +2 -2
  44. data/lib/pokeapi_client/api/move_category_api.rb +2 -2
  45. data/lib/pokeapi_client/api/move_damage_class_api.rb +2 -2
  46. data/lib/pokeapi_client/api/move_learn_method_api.rb +2 -2
  47. data/lib/pokeapi_client/api/move_target_api.rb +2 -2
  48. data/lib/pokeapi_client/api/nature_api.rb +2 -2
  49. data/lib/pokeapi_client/api/pal_park_area_api.rb +2 -2
  50. data/lib/pokeapi_client/api/pokeathlon_stat_api.rb +2 -2
  51. data/lib/pokeapi_client/api/pokedex_api.rb +2 -2
  52. data/lib/pokeapi_client/api/pokemon_api.rb +2 -2
  53. data/lib/pokeapi_client/api/pokemon_color_api.rb +2 -2
  54. data/lib/pokeapi_client/api/pokemon_form_api.rb +2 -2
  55. data/lib/pokeapi_client/api/pokemon_habitat_api.rb +2 -2
  56. data/lib/pokeapi_client/api/pokemon_shape_api.rb +2 -2
  57. data/lib/pokeapi_client/api/pokemon_species_api.rb +2 -2
  58. data/lib/pokeapi_client/api/region_api.rb +2 -2
  59. data/lib/pokeapi_client/api/stat_api.rb +2 -2
  60. data/lib/pokeapi_client/api/super_contest_effect_api.rb +2 -2
  61. data/lib/pokeapi_client/api/type_api.rb +2 -2
  62. data/lib/pokeapi_client/api/version_api.rb +2 -2
  63. data/lib/pokeapi_client/api/version_group_api.rb +2 -2
  64. data/lib/pokeapi_client/api_client.rb +26 -24
  65. data/lib/pokeapi_client/api_error.rb +3 -2
  66. data/lib/pokeapi_client/configuration.rb +28 -9
  67. data/lib/pokeapi_client/version.rb +3 -3
  68. data/lib/pokeapi_client.rb +2 -2
  69. data/pokeapi_client.gemspec +6 -5
  70. data/spec/api/ability_api_spec.rb +4 -4
  71. data/spec/api/berry_api_spec.rb +4 -4
  72. data/spec/api/berry_firmness_api_spec.rb +4 -4
  73. data/spec/api/berry_flavor_api_spec.rb +4 -4
  74. data/spec/api/characteristic_api_spec.rb +4 -4
  75. data/spec/api/contest_effect_api_spec.rb +4 -4
  76. data/spec/api/contest_type_api_spec.rb +4 -4
  77. data/spec/api/egg_group_api_spec.rb +4 -4
  78. data/spec/api/encounter_condition_api_spec.rb +4 -4
  79. data/spec/api/encounter_condition_value_api_spec.rb +4 -4
  80. data/spec/api/encounter_method_api_spec.rb +4 -4
  81. data/spec/api/evolution_chain_api_spec.rb +4 -4
  82. data/spec/api/evolution_trigger_api_spec.rb +4 -4
  83. data/spec/api/gender_api_spec.rb +4 -4
  84. data/spec/api/generation_api_spec.rb +4 -4
  85. data/spec/api/growth_rate_api_spec.rb +4 -4
  86. data/spec/api/item_api_spec.rb +4 -4
  87. data/spec/api/item_attribute_api_spec.rb +4 -4
  88. data/spec/api/item_category_api_spec.rb +4 -4
  89. data/spec/api/item_fling_effect_api_spec.rb +4 -4
  90. data/spec/api/item_pocket_api_spec.rb +4 -4
  91. data/spec/api/language_api_spec.rb +4 -4
  92. data/spec/api/location_api_spec.rb +4 -4
  93. data/spec/api/location_area_api_spec.rb +4 -4
  94. data/spec/api/machine_api_spec.rb +4 -4
  95. data/spec/api/move_ailment_api_spec.rb +4 -4
  96. data/spec/api/move_api_spec.rb +4 -4
  97. data/spec/api/move_battle_style_api_spec.rb +4 -4
  98. data/spec/api/move_category_api_spec.rb +4 -4
  99. data/spec/api/move_damage_class_api_spec.rb +4 -4
  100. data/spec/api/move_learn_method_api_spec.rb +4 -4
  101. data/spec/api/move_target_api_spec.rb +4 -4
  102. data/spec/api/nature_api_spec.rb +4 -4
  103. data/spec/api/pal_park_area_api_spec.rb +4 -4
  104. data/spec/api/pokeathlon_stat_api_spec.rb +4 -4
  105. data/spec/api/pokedex_api_spec.rb +4 -4
  106. data/spec/api/pokemon_api_spec.rb +4 -4
  107. data/spec/api/pokemon_color_api_spec.rb +4 -4
  108. data/spec/api/pokemon_form_api_spec.rb +4 -4
  109. data/spec/api/pokemon_habitat_api_spec.rb +4 -4
  110. data/spec/api/pokemon_shape_api_spec.rb +4 -4
  111. data/spec/api/pokemon_species_api_spec.rb +4 -4
  112. data/spec/api/region_api_spec.rb +4 -4
  113. data/spec/api/stat_api_spec.rb +4 -4
  114. data/spec/api/super_contest_effect_api_spec.rb +4 -4
  115. data/spec/api/type_api_spec.rb +4 -4
  116. data/spec/api/version_api_spec.rb +4 -4
  117. data/spec/api/version_group_api_spec.rb +4 -4
  118. data/spec/spec_helper.rb +2 -2
  119. metadata +46 -49
  120. data/spec/api_client_spec.rb +0 -226
  121. data/spec/configuration_spec.rb +0 -42
@@ -4,9 +4,9 @@
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
6
  The version of the OpenAPI document: 20220523
7
- Contact: blah@cliffano.com
7
+ Contact: blah+oapicf@cliffano.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0-SNAPSHOT
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -39,7 +39,7 @@ describe 'SuperContestEffectApi' do
39
39
  # @return [String]
40
40
  describe 'super_contest_effect_list test' do
41
41
  it 'should work' do
42
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
42
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
43
43
  end
44
44
  end
45
45
 
@@ -49,7 +49,7 @@ describe 'SuperContestEffectApi' do
49
49
  # @return [String]
50
50
  describe 'super_contest_effect_read test' do
51
51
  it 'should work' do
52
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
52
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
53
53
  end
54
54
  end
55
55
 
@@ -4,9 +4,9 @@
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
6
  The version of the OpenAPI document: 20220523
7
- Contact: blah@cliffano.com
7
+ Contact: blah+oapicf@cliffano.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0-SNAPSHOT
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -39,7 +39,7 @@ describe 'TypeApi' do
39
39
  # @return [String]
40
40
  describe 'type_list test' do
41
41
  it 'should work' do
42
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
42
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
43
43
  end
44
44
  end
45
45
 
@@ -49,7 +49,7 @@ describe 'TypeApi' do
49
49
  # @return [String]
50
50
  describe 'type_read test' do
51
51
  it 'should work' do
52
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
52
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
53
53
  end
54
54
  end
55
55
 
@@ -4,9 +4,9 @@
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
6
  The version of the OpenAPI document: 20220523
7
- Contact: blah@cliffano.com
7
+ Contact: blah+oapicf@cliffano.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0-SNAPSHOT
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -39,7 +39,7 @@ describe 'VersionApi' do
39
39
  # @return [String]
40
40
  describe 'version_list test' do
41
41
  it 'should work' do
42
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
42
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
43
43
  end
44
44
  end
45
45
 
@@ -49,7 +49,7 @@ describe 'VersionApi' do
49
49
  # @return [String]
50
50
  describe 'version_read test' do
51
51
  it 'should work' do
52
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
52
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
53
53
  end
54
54
  end
55
55
 
@@ -4,9 +4,9 @@
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
6
  The version of the OpenAPI document: 20220523
7
- Contact: blah@cliffano.com
7
+ Contact: blah+oapicf@cliffano.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0-SNAPSHOT
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
@@ -39,7 +39,7 @@ describe 'VersionGroupApi' do
39
39
  # @return [String]
40
40
  describe 'version_group_list test' do
41
41
  it 'should work' do
42
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
42
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
43
43
  end
44
44
  end
45
45
 
@@ -49,7 +49,7 @@ describe 'VersionGroupApi' do
49
49
  # @return [String]
50
50
  describe 'version_group_read test' do
51
51
  it 'should work' do
52
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
52
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
53
53
  end
54
54
  end
55
55
 
data/spec/spec_helper.rb CHANGED
@@ -4,9 +4,9 @@
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
6
  The version of the OpenAPI document: 20220523
7
- Contact: blah@cliffano.com
7
+ Contact: blah+oapicf@cliffano.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0-SNAPSHOT
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pokeapi_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
- - Cliffano Subagio
8
- autorequire:
7
+ - OpenAPI Clients Factory
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-17 00:00:00.000000000 Z
11
+ date: 2024-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -52,7 +52,7 @@ dependencies:
52
52
  version: 3.6.0
53
53
  description: No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
54
54
  email:
55
- - blah@cliffano.com
55
+ - blah+oapicf@cliffano.com
56
56
  executables: []
57
57
  extensions: []
58
58
  extra_rdoc_files: []
@@ -67,6 +67,7 @@ files:
67
67
  - bin/htmldiff
68
68
  - bin/ldiff
69
69
  - bin/pry
70
+ - bin/racc
70
71
  - bin/rake
71
72
  - bin/rspec
72
73
  - bin/rubocop
@@ -223,14 +224,12 @@ files:
223
224
  - spec/api/type_api_spec.rb
224
225
  - spec/api/version_api_spec.rb
225
226
  - spec/api/version_group_api_spec.rb
226
- - spec/api_client_spec.rb
227
- - spec/configuration_spec.rb
228
227
  - spec/spec_helper.rb
229
- homepage: https://github.com/cliffano/pokeapi-clients
228
+ homepage: https://github.com/oapicf/pokeapi-clients
230
229
  licenses:
231
230
  - MIT
232
231
  metadata: {}
233
- post_install_message:
232
+ post_install_message:
234
233
  rdoc_options: []
235
234
  require_paths:
236
235
  - lib
@@ -246,58 +245,56 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
245
  version: '0'
247
246
  requirements: []
248
247
  rubygems_version: 3.1.2
249
- signing_key:
248
+ signing_key:
250
249
  specification_version: 4
251
250
  summary: Ruby Gem
252
251
  test_files:
253
- - spec/api/item_pocket_api_spec.rb
254
- - spec/api/stat_api_spec.rb
255
- - spec/api/move_api_spec.rb
256
- - spec/api/move_battle_style_api_spec.rb
257
- - spec/api/machine_api_spec.rb
258
- - spec/api/berry_api_spec.rb
259
- - spec/api/super_contest_effect_api_spec.rb
260
- - spec/api/move_damage_class_api_spec.rb
261
- - spec/api/berry_firmness_api_spec.rb
252
+ - spec/api/evolution_trigger_api_spec.rb
253
+ - spec/api/egg_group_api_spec.rb
254
+ - spec/api/evolution_chain_api_spec.rb
262
255
  - spec/api/item_attribute_api_spec.rb
263
- - spec/api/region_api_spec.rb
264
- - spec/api/item_category_api_spec.rb
256
+ - spec/api/growth_rate_api_spec.rb
257
+ - spec/api/pokemon_api_spec.rb
265
258
  - spec/api/generation_api_spec.rb
266
- - spec/api/move_category_api_spec.rb
267
259
  - spec/api/move_ailment_api_spec.rb
268
- - spec/api/location_api_spec.rb
269
- - spec/api/move_learn_method_api_spec.rb
270
- - spec/api/contest_type_api_spec.rb
260
+ - spec/api/encounter_condition_value_api_spec.rb
261
+ - spec/api/location_area_api_spec.rb
262
+ - spec/api/machine_api_spec.rb
271
263
  - spec/api/encounter_method_api_spec.rb
264
+ - spec/api/region_api_spec.rb
265
+ - spec/api/nature_api_spec.rb
266
+ - spec/api/super_contest_effect_api_spec.rb
267
+ - spec/api/pokeathlon_stat_api_spec.rb
272
268
  - spec/api/pokemon_form_api_spec.rb
273
- - spec/api/location_area_api_spec.rb
274
- - spec/api/encounter_condition_value_api_spec.rb
269
+ - spec/api/item_api_spec.rb
270
+ - spec/api/contest_effect_api_spec.rb
271
+ - spec/api/language_api_spec.rb
272
+ - spec/api/stat_api_spec.rb
273
+ - spec/api/gender_api_spec.rb
275
274
  - spec/api/encounter_condition_api_spec.rb
275
+ - spec/api/type_api_spec.rb
276
+ - spec/api/move_damage_class_api_spec.rb
277
+ - spec/api/pokemon_species_api_spec.rb
276
278
  - spec/api/characteristic_api_spec.rb
277
- - spec/api/language_api_spec.rb
278
- - spec/api/item_fling_effect_api_spec.rb
279
- - spec/api/evolution_chain_api_spec.rb
280
- - spec/api/pokemon_api_spec.rb
279
+ - spec/api/berry_api_spec.rb
280
+ - spec/api/move_category_api_spec.rb
281
+ - spec/api/move_learn_method_api_spec.rb
282
+ - spec/api/move_target_api_spec.rb
283
+ - spec/api/pal_park_area_api_spec.rb
284
+ - spec/api/item_pocket_api_spec.rb
285
+ - spec/api/version_api_spec.rb
286
+ - spec/api/pokemon_shape_api_spec.rb
281
287
  - spec/api/pokemon_habitat_api_spec.rb
282
- - spec/api/contest_effect_api_spec.rb
283
- - spec/api/type_api_spec.rb
284
288
  - spec/api/pokemon_color_api_spec.rb
285
- - spec/api/item_api_spec.rb
286
- - spec/api/move_target_api_spec.rb
287
- - spec/api/egg_group_api_spec.rb
288
- - spec/api/berry_flavor_api_spec.rb
289
- - spec/api/nature_api_spec.rb
290
- - spec/api/pokeathlon_stat_api_spec.rb
289
+ - spec/api/move_battle_style_api_spec.rb
290
+ - spec/api/ability_api_spec.rb
291
291
  - spec/api/version_group_api_spec.rb
292
- - spec/api/pokemon_species_api_spec.rb
293
- - spec/api/pokemon_shape_api_spec.rb
292
+ - spec/api/item_category_api_spec.rb
293
+ - spec/api/move_api_spec.rb
294
+ - spec/api/berry_flavor_api_spec.rb
295
+ - spec/api/item_fling_effect_api_spec.rb
296
+ - spec/api/contest_type_api_spec.rb
297
+ - spec/api/location_api_spec.rb
294
298
  - spec/api/pokedex_api_spec.rb
295
- - spec/api/growth_rate_api_spec.rb
296
- - spec/api/evolution_trigger_api_spec.rb
297
- - spec/api/ability_api_spec.rb
298
- - spec/api/gender_api_spec.rb
299
- - spec/api/pal_park_area_api_spec.rb
300
- - spec/api/version_api_spec.rb
301
- - spec/api_client_spec.rb
302
- - spec/configuration_spec.rb
299
+ - spec/api/berry_firmness_api_spec.rb
303
300
  - spec/spec_helper.rb
@@ -1,226 +0,0 @@
1
- =begin
2
- #
3
-
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
-
6
- The version of the OpenAPI document: 20220523
7
- Contact: blah@cliffano.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0-SNAPSHOT
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
-
15
- describe PokeApiClient::ApiClient do
16
- context 'initialization' do
17
- context 'URL stuff' do
18
- context 'host' do
19
- it 'removes http from host' do
20
- PokeApiClient.configure { |c| c.host = 'http://example.com' }
21
- expect(PokeApiClient::Configuration.default.host).to eq('example.com')
22
- end
23
-
24
- it 'removes https from host' do
25
- PokeApiClient.configure { |c| c.host = 'https://wookiee.com' }
26
- expect(PokeApiClient::ApiClient.default.config.host).to eq('wookiee.com')
27
- end
28
-
29
- it 'removes trailing path from host' do
30
- PokeApiClient.configure { |c| c.host = 'hobo.com/v4' }
31
- expect(PokeApiClient::Configuration.default.host).to eq('hobo.com')
32
- end
33
- end
34
-
35
- context 'base_path' do
36
- it "prepends a slash to base_path" do
37
- PokeApiClient.configure { |c| c.base_path = 'v4/dog' }
38
- expect(PokeApiClient::Configuration.default.base_path).to eq('/v4/dog')
39
- end
40
-
41
- it "doesn't prepend a slash if one is already there" do
42
- PokeApiClient.configure { |c| c.base_path = '/v4/dog' }
43
- expect(PokeApiClient::Configuration.default.base_path).to eq('/v4/dog')
44
- end
45
-
46
- it "ends up as a blank string if nil" do
47
- PokeApiClient.configure { |c| c.base_path = nil }
48
- expect(PokeApiClient::Configuration.default.base_path).to eq('')
49
- end
50
- end
51
- end
52
- end
53
-
54
- describe 'params_encoding in #build_request' do
55
- let(:config) { PokeApiClient::Configuration.new }
56
- let(:api_client) { PokeApiClient::ApiClient.new(config) }
57
-
58
- it 'defaults to nil' do
59
- expect(PokeApiClient::Configuration.default.params_encoding).to eq(nil)
60
- expect(config.params_encoding).to eq(nil)
61
-
62
- request = api_client.build_request(:get, '/test')
63
- expect(request.options[:params_encoding]).to eq(nil)
64
- end
65
-
66
- it 'can be customized' do
67
- config.params_encoding = :multi
68
- request = api_client.build_request(:get, '/test')
69
- expect(request.options[:params_encoding]).to eq(:multi)
70
- end
71
- end
72
-
73
- describe 'timeout in #build_request' do
74
- let(:config) { PokeApiClient::Configuration.new }
75
- let(:api_client) { PokeApiClient::ApiClient.new(config) }
76
-
77
- it 'defaults to 0' do
78
- expect(PokeApiClient::Configuration.default.timeout).to eq(0)
79
- expect(config.timeout).to eq(0)
80
-
81
- request = api_client.build_request(:get, '/test')
82
- expect(request.options[:timeout]).to eq(0)
83
- end
84
-
85
- it 'can be customized' do
86
- config.timeout = 100
87
- request = api_client.build_request(:get, '/test')
88
- expect(request.options[:timeout]).to eq(100)
89
- end
90
- end
91
-
92
- describe '#deserialize' do
93
- it "handles Array<Integer>" do
94
- api_client = PokeApiClient::ApiClient.new
95
- headers = { 'Content-Type' => 'application/json' }
96
- response = double('response', headers: headers, body: '[12, 34]')
97
- data = api_client.deserialize(response, 'Array<Integer>')
98
- expect(data).to be_instance_of(Array)
99
- expect(data).to eq([12, 34])
100
- end
101
-
102
- it 'handles Array<Array<Integer>>' do
103
- api_client = PokeApiClient::ApiClient.new
104
- headers = { 'Content-Type' => 'application/json' }
105
- response = double('response', headers: headers, body: '[[12, 34], [56]]')
106
- data = api_client.deserialize(response, 'Array<Array<Integer>>')
107
- expect(data).to be_instance_of(Array)
108
- expect(data).to eq([[12, 34], [56]])
109
- end
110
-
111
- it 'handles Hash<String, String>' do
112
- api_client = PokeApiClient::ApiClient.new
113
- headers = { 'Content-Type' => 'application/json' }
114
- response = double('response', headers: headers, body: '{"message": "Hello"}')
115
- data = api_client.deserialize(response, 'Hash<String, String>')
116
- expect(data).to be_instance_of(Hash)
117
- expect(data).to eq(:message => 'Hello')
118
- end
119
- end
120
-
121
- describe "#object_to_hash" do
122
- it 'ignores nils and includes empty arrays' do
123
- # uncomment below to test object_to_hash for model
124
- # api_client = PokeApiClient::ApiClient.new
125
- # _model = PokeApiClient::ModelName.new
126
- # update the model attribute below
127
- # _model.id = 1
128
- # update the expected value (hash) below
129
- # expected = {id: 1, name: '', tags: []}
130
- # expect(api_client.object_to_hash(_model)).to eq(expected)
131
- end
132
- end
133
-
134
- describe '#build_collection_param' do
135
- let(:param) { ['aa', 'bb', 'cc'] }
136
- let(:api_client) { PokeApiClient::ApiClient.new }
137
-
138
- it 'works for csv' do
139
- expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
140
- end
141
-
142
- it 'works for ssv' do
143
- expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
144
- end
145
-
146
- it 'works for tsv' do
147
- expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
148
- end
149
-
150
- it 'works for pipes' do
151
- expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
152
- end
153
-
154
- it 'works for multi' do
155
- expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
156
- end
157
-
158
- it 'fails for invalid collection format' do
159
- expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
160
- end
161
- end
162
-
163
- describe '#json_mime?' do
164
- let(:api_client) { PokeApiClient::ApiClient.new }
165
-
166
- it 'works' do
167
- expect(api_client.json_mime?(nil)).to eq false
168
- expect(api_client.json_mime?('')).to eq false
169
-
170
- expect(api_client.json_mime?('application/json')).to eq true
171
- expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
172
- expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
173
-
174
- expect(api_client.json_mime?('application/xml')).to eq false
175
- expect(api_client.json_mime?('text/plain')).to eq false
176
- expect(api_client.json_mime?('application/jsonp')).to eq false
177
- end
178
- end
179
-
180
- describe '#select_header_accept' do
181
- let(:api_client) { PokeApiClient::ApiClient.new }
182
-
183
- it 'works' do
184
- expect(api_client.select_header_accept(nil)).to be_nil
185
- expect(api_client.select_header_accept([])).to be_nil
186
-
187
- expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
188
- expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
189
- expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
190
-
191
- expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
192
- expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
193
- end
194
- end
195
-
196
- describe '#select_header_content_type' do
197
- let(:api_client) { PokeApiClient::ApiClient.new }
198
-
199
- it 'works' do
200
- expect(api_client.select_header_content_type(nil)).to be_nil
201
- expect(api_client.select_header_content_type([])).to be_nil
202
-
203
- expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
204
- expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
205
- expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
206
- expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
207
- expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
208
- end
209
- end
210
-
211
- describe '#sanitize_filename' do
212
- let(:api_client) { PokeApiClient::ApiClient.new }
213
-
214
- it 'works' do
215
- expect(api_client.sanitize_filename('sun')).to eq('sun')
216
- expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
217
- expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
218
- expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
219
- expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
220
- expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
221
- expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
222
- expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
223
- expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
224
- end
225
- end
226
- end
@@ -1,42 +0,0 @@
1
- =begin
2
- #
3
-
4
- #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
-
6
- The version of the OpenAPI document: 20220523
7
- Contact: blah@cliffano.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.1.0-SNAPSHOT
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
-
15
- describe PokeApiClient::Configuration do
16
- let(:config) { PokeApiClient::Configuration.default }
17
-
18
- before(:each) do
19
- # uncomment below to setup host and base_path
20
- # require 'URI'
21
- # uri = URI.parse("https://pokeapi.co")
22
- # PokeApiClient.configure do |c|
23
- # c.host = uri.host
24
- # c.base_path = uri.path
25
- # end
26
- end
27
-
28
- describe '#base_url' do
29
- it 'should have the default value' do
30
- # uncomment below to test default value of the base path
31
- # expect(config.base_url).to eq("https://pokeapi.co")
32
- end
33
-
34
- it 'should remove trailing slashes' do
35
- [nil, '', '/', '//'].each do |base_path|
36
- config.base_path = base_path
37
- # uncomment below to test trailing slashes
38
- # expect(config.base_url).to eq("https://pokeapi.co")
39
- end
40
- end
41
- end
42
- end