active_operator 0.1.0 → 0.1.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: 6b9cf2ed21ea684d81d26477429ede619d17b88eac2d5f84684419221a026a2b
4
- data.tar.gz: 644dc660407b17b845086e62004ed5f0d7d0ba29ba31bb81abe801480124ef2e
3
+ metadata.gz: '09fe593232b034c394560f2c19ee8e787695932adfdb34f7c011c5eb47ff4c3f'
4
+ data.tar.gz: ce771f84a9b42a0d4abe096c471872e854ad45ec8c563ba178eca23f30a4d549
5
5
  SHA512:
6
- metadata.gz: f7efb4a3cb1688678025b2a55124dc0b3c75da573d8c9b4b6bc093e01871cdd2470b3f7357fcf6d360c4bb559ba40cdbe6f4d2ffe2e8fffcba1cdb92b6ad2b5e
7
- data.tar.gz: 4bca940a6bd59dd0c8d3bd27d33b10986ed1f932e20248a9674e9c8e1ac8520dbedce44c03910d4d920e907a11dd28fec2b840bc1f71fe2946cbcb3ee68d8807
6
+ metadata.gz: b932606263f03513d910b49845865ccb98d43cef2777c262e10b127438999c833451bfe73e0533850ece571cd9c4d8ca90c330b3266d9f7db0a3fbfee4b4a2c5
7
+ data.tar.gz: cfef1c1e7898088004fb044f7032516f3f1560db0175eb929cf2837ee5401357ca1cee81b11e83759627cbd5c15caefc79e75a75cc8f466c24cfc397cb54cd0f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.1] - 2025-07-08
4
+
5
+ - New Rails generator for creating operations by @luizkowalski in #2
6
+
3
7
  ## [0.1.0] - 2025-07-05
4
8
 
5
9
  - Initial release
data/README.md CHANGED
@@ -22,7 +22,7 @@ rails db:migrate
22
22
 
23
23
  ### 1. Define an Operation
24
24
 
25
- Create operation classes that inherit from `ApplicationOperation`:
25
+ Generate an operation class by running `rails generate active_operator:operation [name]`.
26
26
 
27
27
  ```ruby
28
28
  class Geocoding::V1 < ApplicationOperation
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveOperator
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
@@ -0,0 +1,20 @@
1
+ require 'rails/generators'
2
+ require 'active_support/inflector'
3
+
4
+ module ActiveOperator
5
+ module Generators
6
+ class OperationGenerator < Rails::Generators::NamedBase
7
+ include Rails::Generators::ResourceHelpers
8
+
9
+ check_class_collision
10
+
11
+ source_root File.expand_path("templates", __dir__)
12
+
13
+ desc "Generates an operation with the given NAME."
14
+
15
+ def create_operation_file
16
+ template "operation.rb.erb", "app/operations/#{file_path}.rb"
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,22 @@
1
+ class <%= class_name %> < ApplicationOperation
2
+ def request
3
+ # faraday.get(
4
+ # "https://api.geocod.io/v1.8/geocode",
5
+ # {
6
+ # q: record.address,
7
+ # api_key: Rails.application.credentials.dig(:geocodio, :api_key),
8
+ # fields: "timezone"
9
+ # }
10
+ # )
11
+ end
12
+
13
+ def process
14
+ # result = response.dig("body", "results", 0)
15
+
16
+ # record.update!(
17
+ # latitude: result.dig("location", "lat"),
18
+ # longitude: result.dig("location", "lng"),
19
+ # timezone: result.dig("fields", "timezone", "name")
20
+ # )
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_operator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Smith
@@ -53,8 +53,10 @@ files:
53
53
  - lib/active_operator/railtie.rb
54
54
  - lib/active_operator/version.rb
55
55
  - lib/generators/active_operator/install_generator.rb
56
+ - lib/generators/active_operator/operation_generator.rb
56
57
  - lib/generators/active_operator/templates/application_operation.rb.erb
57
58
  - lib/generators/active_operator/templates/create_active_operator_operations.rb.erb
59
+ - lib/generators/active_operator/templates/operation.rb.erb
58
60
  homepage: https://github.com/jeremysmithco/active_operator
59
61
  licenses:
60
62
  - MIT