resteze 0.1.0 → 0.3.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bbe0973ffabaab62515892208bebf19b154493382a272236d833c6b8e621b1e
4
- data.tar.gz: f3674096d21235157673d5678d4586549b111e67842a24778e830b7507124123
3
+ metadata.gz: 4be8c1254251ae0e6d2fb624d9ebbfff5ddc309d903ffe1ded346d816b4a3cf0
4
+ data.tar.gz: b49908651339547627e4a46b13944d9029ce06bea3a1a189fc63538b7fb54cb2
5
5
  SHA512:
6
- metadata.gz: 0ddebadb823fc854a48f99c547134458f2be39f229d76d58bbc872ebae0aaa8b48296596565bb2d2f3e612bc0164949489e05ce212b1cb78f11bb0c40164d160
7
- data.tar.gz: b534a50b9674cb29c570610d320bbead76f21548119bd8b5c9580938be459a8704a230eba2ef4dbb1a08b5ab9620c4978bd462356a4259429dec838e2c294ed7
6
+ metadata.gz: d318326b40178c6bbcfb949908e37742d56c74c1e366ec4522c217bc5886b21f2884536b94d814f17e1c2ab7262a5820df0b43ed481302f5b6bcc6071af2e64d
7
+ data.tar.gz: 62db4cc4bc2edf0761b258ef64b7e4edf42faea613099c3ab7091434c0d4fea100bcca33604e910e0943c07a242f807f6165f06d9e94195aba10f9deb6381d47
data/.rubocop.yml CHANGED
@@ -7,6 +7,9 @@ inherit_mode:
7
7
  merge:
8
8
  - Exclude
9
9
 
10
+ Layout/LineLength:
11
+ Max: 125
12
+
10
13
  Metrics/ParameterLists:
11
14
  Exclude:
12
15
  - lib/resteze/errors.rb
@@ -25,9 +28,15 @@ Metrics/ClassLength:
25
28
  - lib/resteze/client.rb
26
29
  - test/**/*
27
30
 
31
+ Metrics/MethodLength:
32
+ Max: 15
33
+
28
34
  Minitest/MultipleAssertions:
29
35
  Max: 6
30
36
 
37
+ Style/Documentation:
38
+ Enabled: false
39
+
31
40
  Style/FrozenStringLiteralComment:
32
41
  Enabled: false
33
42
 
@@ -37,5 +46,6 @@ Style/StringLiterals:
37
46
 
38
47
  AllCops:
39
48
  NewCops: enable
49
+ TargetRubyVersion: 3.2
40
50
  Exclude:
41
- - 'bin/*'
51
+ - "bin/*"
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.4.2
data/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.3.1]
6
+
7
+ ### Added
8
+
9
+ - Minitest and RSpec testing helpers for resources and configuration.
10
+
11
+ ## [0.3.0]
12
+
13
+ ### Added
14
+
15
+ - Initial implementation of Resteze, a framework for building REST API client gems.
16
+ - Support for defining API resources, requests, and responses.
17
+ - Configuration management for API clients.
18
+ - Integration with Faraday, Hashie, and ActiveSupport.
19
+ - Middleware for error handling and request transformation.
20
+ - Serialization and deserialization of API responses.
21
+ - Thread-safe client management.
22
+ - Flexible resource paths and property mapping.
23
+
24
+ ## [0.1.0] - 2025-08-12
25
+
26
+ ### Added
27
+
28
+ - First public release.
29
+ - Documentation and usage examples.
30
+ - CI workflow for RuboCop and tests across Ruby 3.2–3.4.4.
31
+ - Code coverage reporting integration.
data/Guardfile CHANGED
@@ -3,6 +3,5 @@ directories %w[lib test]
3
3
  guard :minitest, all_on_start: false do
4
4
  watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
5
5
  watch(%r{^test/.+_test\.rb$})
6
- watch(%r{^test/factories\.rb$}) { "test" }
7
6
  watch(%r{^test/test_helper\.rb$}) { "test" }
8
7
  end
data/README.md CHANGED
@@ -1,38 +1,86 @@
1
- # Resteze
1
+ <div style="display: block; text-align: center;">
2
+ <img src="assets/resteze.svg" alt="Resteze API Ointment" width="128" style="margin: auto;">
3
+ </div>
2
4
 
3
- TODO: Delete this and the text below, and describe your gem
5
+ [![Continuous Integration](https://github.com/rwx-services/resteze/actions/workflows/ci.yml/badge.svg)](https://github.com/rwx-services/resteze/actions/workflows/ci.yml)
6
+ [![Gem Version](https://badge.fury.io/rb/resteze.svg)](https://badge.fury.io/rb/resteze)
7
+ [![Coverage Status](https://coveralls.io/repos/github/rwx-services/resteze/badge.svg?branch=main)](https://coveralls.io/github/rwx-services/resteze?branch=main)
4
8
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/resteze`. To experiment with that code, run `bin/console` for an interactive prompt.
9
+ ---
10
+
11
+ Resteze is a Ruby library designed to simplify the creation of REST API client gems. It provides a flexible framework for defining API resources, handling requests and responses, managing configuration, and supporting common patterns like listing, saving, and error handling. Built on top of popular Ruby libraries such as Faraday, Hashie, and ActiveSupport, Resteze enables developers to quickly build robust, object-oriented clients for RESTful services, with features for custom resource paths, serialization, and thread-safe client management.
12
+
13
+ But Resteze isn't just for REST! Its resource-oriented design lets you give any API—SOAP, RPC, GraphQL, or even quirky legacy endpoints—a clean, resourceful feel. You can wrap non-RESTful APIs in familiar objects, organize calls as resource methods, and enjoy the same convenience and clarity, no matter how your backend is structured. Resteze helps you tame any API and make it feel right at home in Ruby.
6
14
 
7
15
  ## Installation
8
16
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
17
+ You can install Resteze from RubyGems or use it directly from source.
10
18
 
11
- Install the gem and add to the application's Gemfile by executing:
19
+ ### Install via RubyGems
20
+
21
+ Add Resteze to your application's Gemfile:
22
+
23
+ ```ruby
24
+ bundle add resteze
25
+ ```
26
+
27
+ Then run:
12
28
 
13
29
  ```bash
14
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
30
+ bundle install
15
31
  ```
16
32
 
17
- If bundler is not being used to manage dependencies, install the gem by executing:
33
+ Or install it directly with:
18
34
 
19
35
  ```bash
20
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
36
+ gem install resteze
21
37
  ```
22
38
 
23
39
  ## Usage
24
40
 
25
- TODO: Write usage instructions here
41
+ ### Building an API Client with Resteze
42
+
43
+ To build an API client using Resteze, define a Ruby module for your API and include the `Resteze` concern. Then, create resource classes under your module that inherit from `ApiResource` and define properties for your API objects.
26
44
 
27
- ## Development
45
+ Here's a simple example:
28
46
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
47
+ ```ruby
48
+ require 'resteze'
49
+
50
+ module MyCoolApi
51
+ include Resteze
52
+
53
+ # Configure your API client
54
+ configure do |config|
55
+ config.api_base = 'https://api.example.com/'
56
+ config.api_key = 'your-api-key'
57
+ config.logger = Logger.new($stdout)
58
+ end
59
+
60
+ # Define a resource
61
+ class Widget < ApiResource
62
+ property :id
63
+ property :name
64
+ property :status
65
+ end
66
+ end
67
+
68
+ # Usage example
69
+ widget = MyCoolApi::Widget.retrieve(123)
70
+ puts widget.name
71
+
72
+ # List resources
73
+ widgets = MyCoolApi::Widget.list
74
+ widgets.each do |w|
75
+ puts w.id
76
+ end
77
+ ```
30
78
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
79
+ You can define additional resources, customize paths, and add methods as needed. Resteze handles requests, responses, and error management for you, so you can focus on your API's business logic.
32
80
 
33
81
  ## Contributing
34
82
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/resteze.
83
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rwx-services/resteze.
36
84
 
37
85
  ## License
38
86
 
Binary file