ezapi_client 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/.travis.yml +17 -4
- data/CHANGELOG.md +7 -0
- data/Dockerfile +2 -1
- data/README.md +17 -1
- data/lib/ezapi_client/client.rb +2 -0
- data/lib/ezapi_client/requests/base_request.rb +2 -0
- data/lib/ezapi_client/requests/create_transaction_request.rb +2 -0
- data/lib/ezapi_client/services/exec_command.rb +6 -4
- data/lib/ezapi_client/services/gen_data.rb +3 -0
- data/lib/ezapi_client/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10c2d2cd8bad3fad52f1f5c0eeb0a1c57d6de5f1
|
4
|
+
data.tar.gz: 9b3d0adc8bac74cd5205bb1e23ed9cbe1328bd6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39b6f4c134604674a437009a39e61b6fe4c061e93f3bd08902b3c94edae8667da2b232cc5b7daa7a856b4d7d35272cd5b40a79bdd64e9838c4aa3ee74ff564ae
|
7
|
+
data.tar.gz: 41d2218fd628182eb7bdceb777c0aec4908bb927917bc0a30fb5a4bcd23bfb79451bdedd009219492a9a8bb37c66c7f7bfb535c364100b80c65a6e6d3457b7d9
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.4.0
|
data/.travis.yml
CHANGED
@@ -1,4 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
-
|
4
|
-
|
1
|
+
sudo: required
|
2
|
+
services:
|
3
|
+
- docker
|
4
|
+
env:
|
5
|
+
matrix:
|
6
|
+
- DOCKER_COMPOSE_VERSION=1.14.0
|
7
|
+
global:
|
8
|
+
# PASSWORD
|
9
|
+
secure: 4ryzZIG4hx6/9hlkP+Qd+1r0oggmK/SWzX5okcCOib6XhgEGq/zPeMe5GLtvQsyGV0WHwDk7agkrPGrriEnMtrrpWmBSGrBXtQpqp06pQPb5uhei36vbE1Qzzv495GbghV1+CwXMi+cbNSHm2EXfXiG784QlnkU5iMASTJlDluVi0xhAL0zKes/d/Bt8b1XZxXAte+203oobUUsis6sRKvwyQZg0yRvKEjjuL+9r1tC2gA9gGQB9tzf9uyVhrE3ihw5j7gV8OdcXSOuj7WkeeFLwZ7LP7qcsW3GkTOMlRPt2xBYhxXmIDBNUvifmbr+ETPbouebQCq5UmcG0M5tvyBdlGA1LFEwLfYObiNWAKLnB5zsWbCSuClPbRiz1aK+p/qzf/qxPHZmX1sW+QDsya6RbWwLRahYgf1nmK6tKGhe1XnGJfJRlIEp3diFBwMAL2ok8G/rkpIfyFgXIYAmbZYsHFbt1CDVyTC8kp4JVA1s8NI6gnd1KFps4wv5iOHjgspxXaHdd7bF7IRKm7KZO26nbkhwpEl5hBqAlpxMJGg8YK0KOh5fY7p1ysm/wanOw0e3dZHa+OleDAckzzi/4YugNGCFMr5j6+4efv2pGmRz1zE+9BT4UqDTq8P2TfDtmgD5V+SDZq3qdeFl8d+28dzLIHzUwtuL0LawLRZWOTH4=
|
10
|
+
before_install:
|
11
|
+
- sudo rm /usr/local/bin/docker-compose
|
12
|
+
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
|
13
|
+
- chmod +x docker-compose
|
14
|
+
- sudo mv docker-compose /usr/local/bin
|
15
|
+
script:
|
16
|
+
- docker-compose run app bundle
|
17
|
+
- docker-compose run -e PASSWORD app rspec
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## [0.4.0] - 2017-09-06
|
6
|
+
### Fixed
|
7
|
+
- Fix formatting of stdout and stderr during command execution
|
8
|
+
|
9
|
+
### Added
|
10
|
+
- Add logging capabilities
|
11
|
+
|
5
12
|
## [0.3.0] - 2016-10-11
|
6
13
|
### Added
|
7
14
|
- Include stdout in the exception raised when ExecCommand fails
|
data/Dockerfile
CHANGED
data/README.md
CHANGED
@@ -22,12 +22,28 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
+
Initialize:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
EZAPIClient.new(
|
29
|
+
host: "https://my.host.com",
|
30
|
+
username: "myusername",
|
31
|
+
password: "mypass",
|
32
|
+
eks_path: "/path/to/eks",
|
33
|
+
prv_path: "/path/to/prv",
|
34
|
+
log: true,
|
35
|
+
logger: Rails.logger,
|
36
|
+
)
|
37
|
+
|
38
|
+
```
|
39
|
+
|
25
40
|
See `spec/functional` for examples.
|
26
41
|
|
27
42
|
## Development
|
28
43
|
|
29
|
-
1. Create `.env.
|
44
|
+
1. Create `.env.local` and override the password (see `.env`). If you do not have access to the password but have your own credentials, then will have to override everything except `HOST`.
|
30
45
|
2. `docker-compose build`
|
46
|
+
2. `docker-compose run app bundle`
|
31
47
|
3. `docker-compose run app rspec`
|
32
48
|
|
33
49
|
Note: you do not necessarily need Docker, but it makes development easier. If you want to work on this without it, then you need Java installed. See `Dockerfile` for clues.
|
data/lib/ezapi_client/client.rb
CHANGED
@@ -9,6 +9,8 @@ module EZAPIClient
|
|
9
9
|
attribute :host, String
|
10
10
|
attribute :path, String, lazy: true, default: :default_path
|
11
11
|
attribute :endpoint, String, lazy: true, default: :default_endpoint
|
12
|
+
attribute :logger, Object
|
13
|
+
attribute :log, Boolean
|
12
14
|
|
13
15
|
def call
|
14
16
|
HTTParty.post(endpoint, {
|
@@ -11,10 +11,12 @@ module EZAPIClient
|
|
11
11
|
def call
|
12
12
|
stdout_str, stderr_str, status = Open3.capture3(command)
|
13
13
|
unless status.success?
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
)
|
14
|
+
error_msgs = [
|
15
|
+
stdout_str,
|
16
|
+
stderr_str,
|
17
|
+
].reject { |str| str == "" }.compact.join("; ")
|
18
|
+
msg = ["Error executing command:", error_msgs].join(" ")
|
19
|
+
fail ArgumentError, msg
|
18
20
|
end
|
19
21
|
stdout_str.chomp
|
20
22
|
end
|
@@ -10,12 +10,15 @@ module EZAPIClient
|
|
10
10
|
attribute :message, Hash
|
11
11
|
attribute :json, String, lazy: true, default: :default_json
|
12
12
|
attribute :command, String, lazy: true, default: :default_command
|
13
|
+
attribute :logger, Object
|
14
|
+
attribute :log, Boolean
|
13
15
|
|
14
16
|
def self.call(attributes)
|
15
17
|
self.new(attributes).()
|
16
18
|
end
|
17
19
|
|
18
20
|
def call
|
21
|
+
logger.info(command) if log
|
19
22
|
ExecCommand.(command)
|
20
23
|
end
|
21
24
|
|
data/lib/ezapi_client/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ezapi_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ramon Tayag
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- ".env"
|
175
175
|
- ".gitignore"
|
176
176
|
- ".rspec"
|
177
|
+
- ".ruby-version"
|
177
178
|
- ".travis.yml"
|
178
179
|
- CHANGELOG.md
|
179
180
|
- CODE_OF_CONDUCT.md
|
@@ -228,9 +229,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
229
|
version: '0'
|
229
230
|
requirements: []
|
230
231
|
rubyforge_project:
|
231
|
-
rubygems_version: 2.
|
232
|
+
rubygems_version: 2.6.12
|
232
233
|
signing_key:
|
233
234
|
specification_version: 4
|
234
235
|
summary: Ruby wrapper for EZAPI
|
235
236
|
test_files: []
|
236
|
-
has_rdoc:
|