Skip to content

Commit

Permalink
Little touches here and there
Browse files Browse the repository at this point in the history
  • Loading branch information
xijo committed Nov 7, 2024
1 parent 33676f8 commit 1ecc22a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/taro/rails/definition_buffer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Buffers api definitions in rail controllers (e.g. `accepts MyType`)
# Buffers api definitions in rails controllers (e.g. `accepts MyType`)
# until the next action method is defined (e.g. `def create`).
module Taro::Rails::DefinitionBuffer
def buffered_definition(controller_class)
Expand Down
11 changes: 8 additions & 3 deletions spec/taro/rails/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@
input_type.define_singleton_method(:name) { 'UserInputType' }
input_type.field(:name) { [String, null: false] }

response_type = Class.new(Taro::Types::ObjectType)
response_type.define_singleton_method(:name) { 'UserResponseType' }
response_type.field(:name) { [String, null: false] }

controller_class = Class.new(ActionController::Base) do
def self.name = 'UsersController'

api 'my api'
accepts input_type
returns ok: String
returns ok: response_type
def show
render json: @api_params[:name].upcase
render json: { name: @api_params[:name].upcase }
end
end

Expand All @@ -32,6 +36,7 @@ def show

get(:show, params: { user: { name: 'taro' } })

expect(response.body).to eq('TARO')
debugger
expect(response.body).to eq('{"name":"TARO"}')
end
end
10 changes: 5 additions & 5 deletions taro.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ Gem::Specification.new do |spec|
spec.authors = ["Janosch Müller"]
spec.email = ["[email protected]"]

spec.summary = "TODO: Write a short summary, because RubyGems requires one."
spec.description = "TODO: Write a longer description or delete this line."
spec.homepage = "TODO: Put your gem's website or public repo URL here."
spec.summary = "Typed Api using Ruby Objects."
spec.description = "This library provides an object-based type system for RESTful Ruby APIs, with built-in parameter parsing, response rendering, and OpenAPI schema export."
spec.homepage = "https://github.com/taro-rb/taro"
spec.license = "MIT"
spec.required_ruby_version = ">= 3.2.0"

spec.metadata["rubygems_mfa_required"] = 'true'
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
spec.metadata["source_code_uri"] = "https://github.com/taro-rb/taro"
spec.metadata["changelog_uri"] = "https://github.com/taro-rb/taro/CHANGELOG.md"

# 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.
Expand Down

0 comments on commit 1ecc22a

Please sign in to comment.