-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f9e942
commit a70293d
Showing
9 changed files
with
68 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
begin | ||
require 'aliyunsdkcore' | ||
rescue LoadError | ||
end | ||
|
||
class AliOcr | ||
attr_reader :client | ||
|
||
def initialize(key, secret) | ||
@client = RPCClient.new( | ||
endpoint: 'https://documentautoml.cn-beijing.aliyuncs.com', | ||
api_version: '2022-12-29', | ||
access_key_id: key, | ||
access_key_secret: secret | ||
) | ||
end | ||
|
||
def records | ||
body = { | ||
action: 'DescribeDomainRecords' | ||
} | ||
body.merge! params: { | ||
DomainName: root_domain | ||
} | ||
body.merge! opts: { | ||
method: 'POST', | ||
timeout: 15000 | ||
} | ||
|
||
client.request(**body) | ||
end | ||
|
||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ def set_app | |
|
||
def app_params | ||
params.fetch(:app, {}).permit( | ||
:type, | ||
:name, | ||
:appid, | ||
:secret, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Sync | ||
class AliyunApp < App | ||
include Model::App::AliyunApp | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Sync | ||
module Model::App::AliyunApp | ||
extend ActiveSupport::Concern | ||
|
||
def api | ||
return @api if defined? @api | ||
@api = AliOcr.new(appid, sceret) | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,7 @@ zh: | |
init: 默认 | ||
applied: 已修改 | ||
finished: 完成 | ||
sync/app: | ||
type: | ||
Sync::AliyunApp: 阿里云 | ||
Sync::XfyunApp: 讯飞 |