Skip to content

Commit

Permalink
Merge pull request #44 from uichi/feature-42
Browse files Browse the repository at this point in the history
openapi-generator 7.0.0でクライアントAPIを生成
  • Loading branch information
nisyuu authored Sep 12, 2023
2 parents 51f288a + 484ac1b commit 69c9021
Show file tree
Hide file tree
Showing 24 changed files with 220 additions and 150 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ build/

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
.idea
5 changes: 0 additions & 5 deletions .openapi-generator-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,3 @@
#!docs/README.md

.gitignore
.rspec
.rubocop.yml
Gemfile
kendama.gemspec
Rakefile
5 changes: 5 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
.gitlab-ci.yml
.rspec
.rubocop.yml
.travis.yml
Gemfile
README.md
Rakefile
docs/Announcement.md
docs/ResponseBody.md
docs/V1Api.md
git_push.sh
kendama.gemspec
lib/kendama.rb
lib/kendama/api/v1_api.rb
lib/kendama/api_client.rb
Expand Down
2 changes: 1 addition & 1 deletion .openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.6.0
7.0.0
1 change: 0 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
--format documentation
--color
--require spec_helper
43 changes: 18 additions & 25 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ AllCops:
# to ignore them, so only the ones explicitly set in this file are enabled.
DisabledByDefault: true
Exclude:
- "**/templates/**/*"
- "**/vendor/**/*"
- "actionpack/lib/action_dispatch/journey/parser.rb"
- '**/templates/**/*'
- '**/vendor/**/*'
- 'actionpack/lib/action_dispatch/journey/parser.rb'

# Prefer &&/|| over and/or.
Style/AndOr:
Expand All @@ -29,16 +29,16 @@ Layout/EmptyLineAfterMagicComment:
Enabled: true

# In a regular class definition, no empty lines around the body.
# Layout/EmptyLinesAroundClassBody:
# Enabled: true
Layout/EmptyLinesAroundClassBody:
Enabled: true

# In a regular method definition, no empty lines around the body.
Layout/EmptyLinesAroundMethodBody:
Enabled: true

# In a regular module definition, no empty lines around the body.
# Layout/EmptyLinesAroundModuleBody:
# Enabled: true
Layout/EmptyLinesAroundModuleBody:
Enabled: true

Layout/FirstArgumentIndentation:
Enabled: true
Expand All @@ -54,8 +54,8 @@ Layout/IndentationConsistency:
EnforcedStyle: indented_internal_methods

# Two spaces, no tabs (for indentation).
# Layout/IndentationWidth:
# Enabled: true
Layout/IndentationWidth:
Enabled: true

Layout/LeadingCommentSpace:
Enabled: true
Expand All @@ -72,14 +72,14 @@ Layout/SpaceAroundEqualsInParameterDefault:
Layout/SpaceAroundKeyword:
Enabled: true

# Layout/SpaceAroundOperators:
# Enabled: true
Layout/SpaceAroundOperators:
Enabled: true

Layout/SpaceBeforeComma:
Enabled: true
Enabled: true

Layout/SpaceBeforeFirstArg:
Enabled: true
Enabled: true

Style/DefWithParentheses:
Enabled: true
Expand All @@ -101,16 +101,16 @@ Layout/SpaceInsideBlockBraces:
Enabled: true

# Use `{ a: 1 }` not `{a:1}`.
# Layout/SpaceInsideHashLiteralBraces:
# Enabled: true
Layout/SpaceInsideHashLiteralBraces:
Enabled: true

Layout/SpaceInsideParens:
Enabled: true

# Check quotes usage according to lint rule below.
# Style/StringLiterals:
# Enabled: true
# EnforcedStyle: single_quotes
#Style/StringLiterals:
# Enabled: true
# EnforcedStyle: single_quotes

# Detect hard tabs, no hard tabs.
Layout/IndentationStyle:
Expand Down Expand Up @@ -146,10 +146,3 @@ Style/RedundantReturn:
Style/Semicolon:
Enabled: true
AllowAsExpressionSeparator: true

# Style/StringLiteralsInInterpolation:
# Enabled: true
# EnforcedStyle: double_quotes

# Layout/LineLength:
# Max: 120
9 changes: 5 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ source 'https://rubygems.org'

gemspec

gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "rubocop", "~> 1.56"
gem 'pry-byebug'
group :development, :test do
gem 'rake', '~> 13.0.1'
gem 'pry-byebug'
gem 'rubocop', '~> 0.66.0'
end
33 changes: 13 additions & 20 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
base64 (0.1.1)
byebug (11.1.3)
coderay (1.1.3)
diff-lcs (1.5.0)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.15.5)
json (2.6.3)
language_server-protocol (3.17.0.3)
jaro_winkler (1.5.6)
method_source (1.0.0)
parallel (1.23.0)
parser (3.2.2.3)
Expand All @@ -28,11 +26,11 @@ GEM
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
psych (5.1.0)
stringio
racc (1.7.1)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.8.1)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
Expand All @@ -46,24 +44,19 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.56.3)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
rubocop (0.66.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 3.2.2.3)
parser (>= 2.5, != 2.5.1.1)
psych (>= 3.1.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
unicode-display_width (>= 1.4.0, < 1.6)
ruby-progressbar (1.13.0)
stringio (3.0.8)
typhoeus (1.4.0)
ethon (>= 0.9.0)
unicode-display_width (2.4.2)
unicode-display_width (1.5.0)

PLATFORMS
x86_64-darwin-22
Expand All @@ -72,9 +65,9 @@ PLATFORMS
DEPENDENCIES
kendama!
pry-byebug
rake (~> 13.0)
rspec (~> 3.0)
rubocop (~> 1.56)
rake (~> 13.0.1)
rspec (~> 3.6, >= 3.6.0)
rubocop (~> 0.66.0)

BUNDLED WITH
2.4.12
7 changes: 1 addition & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ begin
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

require "rubocop/rake_task"

RuboCop::RakeTask.new

task default: %i[spec rubocop]
task default: :spec
rescue LoadError
# no rspec available
end
26 changes: 6 additions & 20 deletions kendama.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
=begin
#国税庁API
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
#国税庁が提供するインボイス制度適格請求書発行事業者公表システムWeb-APIを使用するためのクライアントAPI(https://www.invoice-kohyo.nta.go.jp/web-api/index.html)
The version of the OpenAPI document: 0.1.0
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.6.0
OpenAPI Generator version: 7.0.0
=end

Expand All @@ -33,28 +33,14 @@ Gem::Specification.new do |s|
s.metadata["source_code_uri"] = "https://github.com/uichi/kendama"
s.metadata["changelog_uri"] = "https://github.com/uichi/kendama/blob/main/CHANGELOG.md"

# Uncomment to register a new dependency of your gem
# spec.add_dependency "example-gem", "~> 1.0"

# For more information and examples about making a new gem, check out our
# guide at: https://bundler.io/guides/creating_gem.html
s.required_ruby_version = ">= 2.7"

s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'

s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'


# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
s.files = Dir.chdir(__dir__) do
`git ls-files -z`.split("\x0").reject do |f|
(File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
end
end
# s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
s.test_files = `find spec/*`.split("\n")
s.bindir = "exe"
s.executables = s.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
# s.executables = []
s.executables = []
s.require_paths = ["lib"]
end
2 changes: 1 addition & 1 deletion lib/kendama.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.6.0
OpenAPI Generator version: 7.0.0
=end

Expand Down
2 changes: 1 addition & 1 deletion lib/kendama/api/v1_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.6.0
OpenAPI Generator version: 7.0.0
=end

Expand Down
2 changes: 1 addition & 1 deletion lib/kendama/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.6.0
OpenAPI Generator version: 7.0.0
=end

Expand Down
2 changes: 1 addition & 1 deletion lib/kendama/api_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.6.0
OpenAPI Generator version: 7.0.0
=end

Expand Down
18 changes: 10 additions & 8 deletions lib/kendama/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.6.0
OpenAPI Generator version: 7.0.0
=end

Expand Down Expand Up @@ -152,7 +152,7 @@ def initialize
@scheme = 'https'
@host = 'kensyo.invoice-kohyo.nta.go.jp'
@base_path = ''
@server_index = 0
@server_index = nil
@server_operation_index = {}
@server_variables = {}
@server_operation_variables = {}
Expand Down Expand Up @@ -200,10 +200,12 @@ def base_path=(base_path)

# Returns base URL for specified operation based on server settings
def base_url(operation = nil)
index = server_operation_index[operation]
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil

server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
if operation_server_settings.key?(operation) then
index = server_operation_index.fetch(operation, server_index)
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
else
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
end
end

# Gets API key (with prefix if set).
Expand Down Expand Up @@ -262,8 +264,8 @@ def server_url(index, variables = {}, servers = nil)
servers = server_settings if servers == nil

# check array index out of bound
if (index < 0 || index >= servers.size)
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
if (index.nil? || index < 0 || index >= servers.size)
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
end

server = servers[index]
Expand Down
Loading

0 comments on commit 69c9021

Please sign in to comment.