k3cloud-sdk 0.2.0 → 0.4.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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +36 -0
- data/lib/k3cloud/configuration.rb +11 -1
- data/lib/k3cloud/errors/k3cloud_error.rb +1 -1
- data/lib/k3cloud/utils/md5_utils.rb +1 -1
- data/lib/k3cloud/version.rb +1 -1
- data/lib/k3cloud/web_api_client.rb +1 -1
- data/lib/k3cloud.rb +7 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fcdb39f0120d7be1d75b2b05088eae22fd6ac5d3fdb422bf25f6a472b729fb3
|
4
|
+
data.tar.gz: 36d2bf34f18781c5a7574b03cbe62dcdbbba8e20b2c63b23860e7c08dc3e9aac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c72cc86924e218be315fb570958bd9289c58a475cc4ac6014de43447030c5f09ab642d784601e5acfea43fdefe0788bcb8ccfa9cb38e221bc549d139180bd80d
|
7
|
+
data.tar.gz: 311051445ab1bb7b3dd719aa17a34538337be2edafce4ce094404fc7d80e2b8b1f0549820f1ee66a3a6bc822f1606cf59af0b9f13f749ae0185e4f5882f6a725
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -13,6 +13,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
13
13
|
|
14
14
|
## Usage
|
15
15
|
|
16
|
+
#### 1. Single Account Configuration:
|
16
17
|
You'll need to configure it in `config/initializers/k3cloud.rb`:
|
17
18
|
|
18
19
|
```ruby
|
@@ -35,6 +36,41 @@ Then you can call the k3cloud API using the following code:
|
|
35
36
|
K3cloud.execute_bill_query(data)
|
36
37
|
```
|
37
38
|
|
39
|
+
#### 2. Multi Account Configuration:
|
40
|
+
You'll need to configure it in `config/initializers/k3cloud.rb`:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
config1 = K3cloud::Configuration.new do |c|
|
44
|
+
c.acct_id = ENV['K3CLOUD1_ACCT_ID']
|
45
|
+
c.user_name = ENV['K3CLOUD1_USERNAME']
|
46
|
+
c.app_id = ENV['K3CLOUD1_APP_ID']
|
47
|
+
c.app_secret= ENV['K3CLOUD1_APP_SECRET']
|
48
|
+
c.server_url = ENV['K3CLOUD1_SERVER_URL']
|
49
|
+
end
|
50
|
+
|
51
|
+
config2 = K3cloud::Configuration.new do |c|
|
52
|
+
c.acct_id = ENV['K3CLOUD2_ACCT_ID']
|
53
|
+
c.user_name = ENV['K3CLOUD2_USERNAME']
|
54
|
+
c.app_id = ENV['K3CLOUD2_APP_ID']
|
55
|
+
c.app_secret= ENV['K3CLOUD2_APP_SECRET']
|
56
|
+
c.server_url = ENV['K3CLOUD2_SERVER_URL']
|
57
|
+
end
|
58
|
+
|
59
|
+
K3cloud1 = K3cloud.new_api(config1)
|
60
|
+
K3cloud2 = K3cloud.new_api(config2)
|
61
|
+
```
|
62
|
+
|
63
|
+
Then you can call the k3cloud API using the following code:
|
64
|
+
```ruby
|
65
|
+
data = {
|
66
|
+
FormId: "",
|
67
|
+
FieldKeys: "",
|
68
|
+
FilterString: ""
|
69
|
+
}
|
70
|
+
K3cloud1.execute_bill_query(data)
|
71
|
+
K3cloud2.execute_bill_query(data)
|
72
|
+
```
|
73
|
+
|
38
74
|
## Development
|
39
75
|
|
40
76
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -31,7 +31,17 @@ module K3cloud
|
|
31
31
|
|
32
32
|
attr_accessor :connect_timeout, :request_timeout
|
33
33
|
|
34
|
-
def initialize
|
34
|
+
def initialize(options = {})
|
35
|
+
@acct_id = options[:acct_id]
|
36
|
+
@user_name = options[:user_name]
|
37
|
+
@password = options[:password]
|
38
|
+
@app_id = options[:app_id]
|
39
|
+
@app_secret = options[:app_secret]
|
40
|
+
@server_url = options[:server_url]
|
41
|
+
@org_num = options[:org_num]
|
42
|
+
@connect_timeout = options[:connect_timeout]
|
43
|
+
@request_timeout = options[:request_timeout]
|
44
|
+
|
35
45
|
yield(self) if block_given?
|
36
46
|
end
|
37
47
|
|
data/lib/k3cloud/version.rb
CHANGED
data/lib/k3cloud.rb
CHANGED
@@ -22,11 +22,15 @@ module K3cloud
|
|
22
22
|
@logger ||= ::Logger.new($stderr)
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
|
25
|
+
def new_api(config = nil)
|
26
|
+
if config
|
27
|
+
K3cloud::K3cloudApi.new(config)
|
28
|
+
else
|
29
|
+
@default_api ||= K3cloud::K3cloudApi.new
|
30
|
+
end
|
27
31
|
end
|
28
32
|
|
29
|
-
def_delegators :
|
33
|
+
def_delegators :new_api, :draft, :save, :batch_save, :submit, :audit, :un_audit, :view, :execute_bill_query, :delete,
|
30
34
|
:cancel_assign, :push, :execute_operation, :allocate, :cancel_allocate, :group_save, :query_group_info,
|
31
35
|
:group_delete, :attachment_upload, :attachment_download, :query_business_info, :get_sys_report_data,
|
32
36
|
:flex_save, :send_msg, :disassembly, :workflow_audit, :switch_org
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k3cloud-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zevinto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby Gem for K3cloud API.
|
14
14
|
email:
|