Skip to content

Commit

Permalink
🫖 ApiChai (#218)
Browse files Browse the repository at this point in the history
Placeholder for a tool that will standardize API integration best
practices

---------

Co-authored-by: Carlos Palhares <[email protected]>
  • Loading branch information
that-jill and xjunior authored Jan 3, 2024
1 parent 87f7153 commit 29879eb
Show file tree
Hide file tree
Showing 29 changed files with 1,142 additions and 23 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/api_chai.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: api_chai

on:
push:

jobs:
ruby:
uses: powerhome/github-actions-workflows/.github/workflows/ruby-gem.yml@main
with:
package: ${{ github.workflow }}
workdir: "packages/${{ github.workflow }}"
secrets: inherit
48 changes: 26 additions & 22 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,62 @@ At [Power Home Remodeling](https://powerhrg.com/), we have created foundational

power-tools currently contains the following packages (marked for release to rubygems 💎 or npm ☕️):

[nitro_config](https://github.com/powerhome/power-tools/blob/main/packages/nitro_config/docs/README.md) 💎
[api_chai](https://github.com/powerhome/power-tools/blob/main/packages/api_chai/docs/README.md) 💎

When included in a Rails application, NitroConfig loads the configuration file at `config/config.yml` within the application directory and makes its values available at `NitroConfig.config`. Config values are loaded based on the Rails environment, permitting the specification of multiple environments' configurations in a single file.
ApiChai provides a simple integration with net-http around a lightweight layer for reporting and graceful error handling.

[audit_tracker](https://github.com/powerhome/power-tools/blob/main/packages/audit_tracker/docs/README.md) 💎

AuditTracker helps you centralize data tracking configuration to be used across different models.

[lumberaxe](https://github.com/powerhome/power-tools/blob/main/packages/lumberaxe/docs/README.md) 💎
[camel_trail](https://github.com/powerhome/power-tools/blob/main/packages/camel_trail/docs/README.md) 💎

Lumberaxe handles logging output formatting.
CamelTrail makes it easy to keep a history of attribute changes on a model.

[consent](https://github.com/powerhome/power-tools/blob/main/packages/consent/docs/README.md) 💎

Consent provides permission-based authorization.

[rubocop-powerhome](https://github.com/powerhome/power-tools/blob/main/packages/rubocop-powerhome/docs/README.md) 💎

This gem is focused on providing standard rubocop configuration for Power Home Remodeling ruby apps. See more in [`rubocop-powerhome`](../packages/rubocop-powerhome).

[rubocop-cobra](https://github.com/powerhome/power-tools/blob/main/packages/rubocop-cobra/docs/README.md) 💎

This gem is focused on providing Cops to support a healthy cobra app development. See more in [`rubocop-cobra`](../packages/rubocop-cobra).

[@powerhome/eslint-config](https://github.com/powerhome/power-tools/blob/main/packages/eslint-config/docs/README.md) ☕️

Shared eslint-config and Prettier formatting from Power Home Remodeling.

[cygnet](https://github.com/powerhome/power-tools/blob/main/packages/cygnet/docs/README.md) 💎

Helping ruby developers implement easy patterns.

[rabbet](https://github.com/powerhome/power-tools/blob/main/packages/rabbet/docs/README.md) 💎
[data_taster](https://github.com/powerhome/power-tools/blob/main/packages/data_taster/docs/README.md) 💎

A shared layout so that your suite of applications can have the same look and feel.
Delicious and sanitized data samples for development and testing.

[edgestitch](https://github.com/powerhome/power-tools/blob/main/packages/edgestitch/docs/README.md) 💎

Edgestitch allows engines to define partial structure-self.sql files to be stitched into a single structure.sql file by the umbrella application.

[camel_trail](https://github.com/powerhome/power-tools/blob/main/packages/camel_trail/docs/README.md) 💎
[lumberaxe](https://github.com/powerhome/power-tools/blob/main/packages/lumberaxe/docs/README.md) 💎

CamelTrail makes it easy to keep a history of attribute changes on a model.
Lumberaxe handles logging output formatting.

[data_taster](https://github.com/powerhome/power-tools/blob/main/packages/data_taster/docs/README.md) 💎
[nitro_config](https://github.com/powerhome/power-tools/blob/main/packages/nitro_config/docs/README.md) 💎

Delicious and sanitized data samples for development and testing.
When included in a Rails application, NitroConfig loads the configuration file at `config/config.yml` within the application directory and makes its values available at `NitroConfig.config`. Config values are loaded based on the Rails environment, permitting the specification of multiple environments' configurations in a single file.

[ostruct-sanitizer](https://github.com/powerhome/power-tools/blob/main/packages/ostruct-sanitizer/docs/README.md) 💎

Rails-like sanitization hooks to be applied to OpenStruct fields.

[@powerhome/eslint-config](https://github.com/powerhome/power-tools/blob/main/packages/eslint-config/docs/README.md) ☕️

Shared eslint-config and Prettier formatting from Power Home Remodeling.

[rabbet](https://github.com/powerhome/power-tools/blob/main/packages/rabbet/docs/README.md) 💎

A shared layout so that your suite of applications can have the same look and feel.

[rubocop-cobra](https://github.com/powerhome/power-tools/blob/main/packages/rubocop-cobra/docs/README.md) 💎

This gem is focused on providing Cops to support a healthy cobra app development. See more in [`rubocop-cobra`](../packages/rubocop-cobra).

[rubocop-powerhome](https://github.com/powerhome/power-tools/blob/main/packages/rubocop-powerhome/docs/README.md) 💎

This gem is focused on providing standard rubocop configuration for Power Home Remodeling ruby apps. See more in [`rubocop-powerhome`](../packages/rubocop-powerhome).

## Installation 🛠

These packages are all meant to install inside of an application and aren't intended to stand alone; currently, they are all published to [RubyGems](https://rubygems.org/) or [npm](https://www.npmjs.com/) and you can use standard methods to install them.
Expand Down
10 changes: 10 additions & 0 deletions packages/api_chai/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/pkg/
/spec/reports/
/tmp/

# rspec failure tracking
.rspec_status
13 changes: 13 additions & 0 deletions packages/api_chai/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
AllCops:
TargetRubyVersion: 2.6

Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
Enabled: true
EnforcedStyle: double_quotes

Layout/LineLength:
Max: 120
13 changes: 13 additions & 0 deletions packages/api_chai/Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

appraise "rails-6-0" do
gem "rails", "6.0.6.1"
end

appraise "rails-6-1" do
gem "rails", "6.1.7.4"
end

appraise "rails-7-0" do
gem "rails", "7.0.6"
end
12 changes: 12 additions & 0 deletions packages/api_chai/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

source "https://rubygems.org"

# Specify your gem's dependencies in api_chai.gemspec
gemspec

gem "rake", "~> 13.0"

gem "rspec", "~> 3.0"

gem "rubocop", "~> 1.21"
130 changes: 130 additions & 0 deletions packages/api_chai/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
PATH
remote: .
specs:
api_chai (0.0.1)

GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
appraisal (2.5.0)
bundler
rake
thor (>= 0.14.0)
ast (2.4.2)
base64 (0.2.0)
bigdecimal (3.1.5)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
diff-lcs (1.5.0)
drb (2.2.0)
ruby2_keywords
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.7.1)
language_server-protocol (3.17.0.3)
license_finder (7.1.0)
bundler
rubyzip (>= 1, < 3)
thor (~> 1.2)
tomlrb (>= 1.3, < 2.1)
with_env (= 1.1.0)
xml-simple (~> 1.1.9)
minitest (5.20.0)
mutex_m (0.2.0)
parallel (1.24.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
racc (1.7.3)
rack (3.0.8)
rainbow (3.1.1)
rake (13.1.0)
regexp_parser (2.8.3)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.59.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-performance (1.20.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-powerhome (0.5.0)
rubocop
rubocop-performance
rubocop-rails
rubocop-rake
rubocop-rspec
rubocop-rails (2.23.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.25.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
thor (1.3.0)
tomlrb (2.0.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
with_env (1.1.0)
xml-simple (1.1.9)
rexml

PLATFORMS
arm64-darwin-22
x86_64-linux

DEPENDENCIES
api_chai!
appraisal (~> 2.5.0)
license_finder (~> 7.0)
rake (~> 13.0)
rspec (~> 3.0)
rubocop (~> 1.21)
rubocop-powerhome (= 0.5.0)

BUNDLED WITH
2.4.22
21 changes: 21 additions & 0 deletions packages/api_chai/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 Jill Klang

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
12 changes: 12 additions & 0 deletions packages/api_chai/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"

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

require "rubocop/rake_task"

RuboCop::RakeTask.new

task default: %i[spec rubocop]
39 changes: 39 additions & 0 deletions packages/api_chai/api_chai.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true

require_relative "lib/api_chai/version"

Gem::Specification.new do |spec|
spec.name = "api_chai"
spec.version = ApiChai::VERSION
spec.authors = ["Jill Klang"]
spec.email = ["[email protected]"]

spec.summary = "net-http simplicity infused with error handling and reporting"
spec.description = "Serve up smooth API integrations lightly steeped in graceful errors, Sentry & NewRelic reporting."
spec.homepage = "https://github.com/powerhome/power-tools"
spec.license = "MIT"
spec.required_ruby_version = ">= 2.6.0"

spec.metadata["rubygems_mfa_required"] = "true"
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = spec.homepage
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/packages/api_chai/docs/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.
spec.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 .github appveyor Gemfile])
end
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "appraisal", "~> 2.5.0"

spec.add_development_dependency "license_finder", "~> 7.0"

spec.add_development_dependency "rubocop-powerhome", "0.5.0"
end
11 changes: 11 additions & 0 deletions packages/api_chai/bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "api_chai"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

require "irb"
IRB.start(__FILE__)
8 changes: 8 additions & 0 deletions packages/api_chai/bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install

# Do any other automated setup that you need to do here
3 changes: 3 additions & 0 deletions packages/api_chai/doc/dependency_decisions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- - :inherit_from
- https://raw.githubusercontent.com/powerhome/oss-guide/master/license_rules.yml
5 changes: 5 additions & 0 deletions packages/api_chai/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## [Unreleased]

## [0.0.1] - 2024-01-03

- Initial release
5 changes: 5 additions & 0 deletions packages/api_chai/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ApiChai

Serve up smooth API integrations with net-http, lightly steeped in graceful errors, Sentry & NewRelic reporting.

More information coming soon.
2 changes: 2 additions & 0 deletions packages/api_chai/gemfiles/.bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
BUNDLE_RETRY: "1"
Loading

0 comments on commit 29879eb

Please sign in to comment.