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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09fe593232b034c394560f2c19ee8e787695932adfdb34f7c011c5eb47ff4c3f'
|
4
|
+
data.tar.gz: ce771f84a9b42a0d4abe096c471872e854ad45ec8c563ba178eca23f30a4d549
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b932606263f03513d910b49845865ccb98d43cef2777c262e10b127438999c833451bfe73e0533850ece571cd9c4d8ca90c330b3266d9f7db0a3fbfee4b4a2c5
|
7
|
+
data.tar.gz: cfef1c1e7898088004fb044f7032516f3f1560db0175eb929cf2837ee5401357ca1cee81b11e83759627cbd5c15caefc79e75a75cc8f466c24cfc397cb54cd0f
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -22,7 +22,7 @@ rails db:migrate
|
|
22
22
|
|
23
23
|
### 1. Define an Operation
|
24
24
|
|
25
|
-
|
25
|
+
Generate an operation class by running `rails generate active_operator:operation [name]`.
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
class Geocoding::V1 < ApplicationOperation
|
@@ -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.
|
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
|