resteze 0.1.0 → 0.3.0

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: da5b0f1ce7cd3e8c2677b9fe22f2c67b755475ea464b25821fc71f4054629bb6
4
+ data.tar.gz: f8a4c6fa0bd2a169b7f8e818dacb14b11a0e6c69bebe49a6b77004a458351a9a
5
5
  SHA512:
6
- metadata.gz: 0ddebadb823fc854a48f99c547134458f2be39f229d76d58bbc872ebae0aaa8b48296596565bb2d2f3e612bc0164949489e05ce212b1cb78f11bb0c40164d160
7
- data.tar.gz: b534a50b9674cb29c570610d320bbead76f21548119bd8b5c9580938be459a8704a230eba2ef4dbb1a08b5ab9620c4978bd462356a4259429dec838e2c294ed7
6
+ metadata.gz: 9c64c532a62d217fc2819c729fb684590ba0d29eb7ca2f83e9c1ee36a3b9db5e32bb2bc5ae082b3c94b6f0b783bc097b634e7668ad362c09cf1b150f7e607e55
7
+ data.tar.gz: 6c5c871ed49367a69b401d32409200234352348ab305a0084b0aab8c61b22921115268dd32724c896d1b2eded83c3632e2d62c3ec8371437d5675b4a7fbc9e84
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/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,84 @@
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)
4
6
 
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.
7
+ ---
8
+
9
+ 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.
10
+
11
+ 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
12
 
7
13
  ## Installation
8
14
 
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.
15
+ You can install Resteze from RubyGems or use it directly from source.
10
16
 
11
- Install the gem and add to the application's Gemfile by executing:
17
+ ### Install via RubyGems
18
+
19
+ Add Resteze to your application's Gemfile:
20
+
21
+ ```ruby
22
+ bundle add resteze
23
+ ```
24
+
25
+ Then run:
12
26
 
13
27
  ```bash
14
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
28
+ bundle install
15
29
  ```
16
30
 
17
- If bundler is not being used to manage dependencies, install the gem by executing:
31
+ Or install it directly with:
18
32
 
19
33
  ```bash
20
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
34
+ gem install resteze
21
35
  ```
22
36
 
23
37
  ## Usage
24
38
 
25
- TODO: Write usage instructions here
39
+ ### Building an API Client with Resteze
40
+
41
+ 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
42
 
27
- ## Development
43
+ Here's a simple example:
28
44
 
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.
45
+ ```ruby
46
+ require 'resteze'
47
+
48
+ module MyCoolApi
49
+ include Resteze
50
+
51
+ # Configure your API client
52
+ configure do |config|
53
+ config.api_base = 'https://api.example.com/'
54
+ config.api_key = 'your-api-key'
55
+ config.logger = Logger.new($stdout)
56
+ end
57
+
58
+ # Define a resource
59
+ class Widget < ApiResource
60
+ property :id
61
+ property :name
62
+ property :status
63
+ end
64
+ end
65
+
66
+ # Usage example
67
+ widget = MyCoolApi::Widget.retrieve(123)
68
+ puts widget.name
69
+
70
+ # List resources
71
+ widgets = MyCoolApi::Widget.list
72
+ widgets.each do |w|
73
+ puts w.id
74
+ end
75
+ ```
30
76
 
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).
77
+ 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
78
 
33
79
  ## Contributing
34
80
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/resteze.
81
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rwx-services/resteze.
36
82
 
37
83
  ## License
38
84
 
Binary file