Skip to content

Commit

Permalink
Add basic configure (#1)
Browse files Browse the repository at this point in the history
olive_branch는 API Response형식을 변환할 수 있게 해주는 middleware입니다.
원본 리포지토리 maintenance가 유지되지 않고 있어서 포크하여 사용하려 합니다.

리포지토리를 포크하고 간단한 수정 사항을 추가합니다.
프로젝트의 루비 버전을 업데이트하고 Readme를 간단하게 수정했습니다.
gemspec을 적당하게 수정하였습니다.
  • Loading branch information
dongcheolpark authored Feb 19, 2024
1 parent 8bd7926 commit 54b0e81
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.1
3.1.2
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@

This gem lets your API users pass in and receive camelCased or dash-cased keys, while your Rails app receives and produces snake_cased ones.

## 📣 This repository is forked repo.

The original repository is no longer actively maintained. (last updated on Nov 19, 2021)

To prepare for problems that may arise, we decided to fork and use it.

This forked repository is also under the MIT License same as original repository.

## Install

1. Add this to your Gemfile and then `bundle install`:
Expand Down Expand Up @@ -40,7 +48,7 @@ For more examples, see [our blog post](https://www.viget.com/articles/introducin
## Optimizations and configuration

`OliveBranch` uses `multi_json`, which will automatically choose the fastest available JSON parsing library present in your application.
Most Ruby applications default to using the JSON library that ships with Ruby. However, by including a coder that `multi_json` considers faster, like [Oj](https://github.com/ohler55/oj) in your gemfile, you can potentially save up to ~20% response time.
Most Ruby applications default to using the JSON library that ships with Ruby. However, by including a coder that `multi_json` considers faster, like [Oj](https://github.com/ohler55/oj) in your gemfile, you can potentially save up to ~20% response time.

The middleware can be initialized with custom camelize/dasherize implementations, so if you know you have a fixed size set of keys, you can save a considerable amount of time by providing a custom camelize that caches like so:

Expand Down Expand Up @@ -110,6 +118,7 @@ config.middleware.use OliveBranch::Middleware, exclude_response: -> (env) {
#### Rails routes & Action Text

If you're using default inflection, exclude the routes that Rails uses

```ruby
rails_routes = -> (env) { env['PATH_INFO'].match(/^\/rails/) }
config.middleware.use OliveBranch::Middleware, inflection: "camel", exclude_params: rails_routes, exclude_response: rails_routes
Expand All @@ -131,11 +140,11 @@ You may choose to force inbound transformation on every request by overriding th
config.middleware.use OliveBranch::Middleware, content_type_check: -> (content_type) { true }
```

* * *
---

OliveBranch is released under the [MIT License](http://www.opensource.org/licenses/MIT). See MIT-LICENSE for further details.

* * *
---

<a href="http://code.viget.com">
<img src="http://code.viget.com/github-banner.png" alt="Code At Viget">
Expand Down
2 changes: 1 addition & 1 deletion lib/olive_branch/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module OliveBranch
VERSION = '4.0.1'
VERSION = '1.0.0'
end
11 changes: 5 additions & 6 deletions olive_branch.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ $:.push File.expand_path("../lib", __FILE__)
require "olive_branch/version"

Gem::Specification.new do |s|
s.name = "olive_branch"
s.name = "privatenote_olive_branch"
s.version = OliveBranch::VERSION
s.summary = "Handle camel/snake/dash case conversion"
s.description = "Handle camel/snake/dash case conversion"
s.authors = ["Eli Fatsi", "David Eisinger"]
s.email = ["eli.fatsi@viget.com", "david.eisinger@viget.com"]
s.description = "Handle camel/snake/dash case conversion. forked from vigetlabs/olive_branch."
s.authors = ["Privatenote"]
s.email = ["dev@privatenote.co.kr"]
s.files = Dir["lib/**/*"] + ["MIT-LICENSE", "README.md"]
s.homepage = "https://github.com/vigetlabs/olive_branch"
s.homepage = "https://github.com/privatenote/olive_branch"
s.license = "MIT"

s.add_dependency "rails", ">= 4.0"
s.add_dependency "multi_json"

s.add_development_dependency "rspec", "~> 3.5.0"
Expand Down

0 comments on commit 54b0e81

Please sign in to comment.