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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f1e227d88c32617992da666064320a7bc92c433
4
- data.tar.gz: 2e4e10c807545ce41724d96247f28bf6242e1609
3
+ metadata.gz: 10c2d2cd8bad3fad52f1f5c0eeb0a1c57d6de5f1
4
+ data.tar.gz: 9b3d0adc8bac74cd5205bb1e23ed9cbe1328bd6e
5
5
  SHA512:
6
- metadata.gz: d3107cdf686fe73b4d5e9fed39b7fef7df885f45083eecc58a807e23262b919d8e6d4de2277dd4eda088c7973102bc1c9263c4144d641a36bf2edda94a8f82ed
7
- data.tar.gz: ff2a76984617687c954e146da9a9b0c7f35ea558cdfb917c5ec2ef22626881785a27f66fc3fe0dc315f4f72951c020641f7ef9dd005a428a51d365389e06e45d
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
- language: ruby
2
- rvm:
3
- - 2.3.0
4
- before_install: gem install bundler -v 1.13.1
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
@@ -1,4 +1,5 @@
1
- FROM ruby:2.3.0
1
+ FROM ruby:2.4.0
2
+
2
3
  RUN apt-get update -qq
3
4
  RUN apt-get upgrade -y
4
5
  RUN apt-get install -y build-essential libpq-dev nodejs postgresql-client openjdk-7-jre
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.sample` 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`.
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.
@@ -7,6 +7,8 @@ module EZAPIClient
7
7
  attribute :password, String
8
8
  attribute :eks_path, String
9
9
  attribute :prv_path, String
10
+ attribute :logger, Object
11
+ attribute :log, Boolean
10
12
 
11
13
  def create_transaction(args)
12
14
  opts = default_opts.merge(args)
@@ -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, {
@@ -102,6 +102,8 @@ module EZAPIClient
102
102
  prv_path: prv_path,
103
103
  reference_no: reference_no,
104
104
  message: message,
105
+ logger: logger,
106
+ log: log,
105
107
  )
106
108
  end
107
109
 
@@ -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
- fail(
15
- ArgumentError,
16
- "Error executing command: #{[stdout_str, stderr_str].compact.join("; ")}"
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
 
@@ -1,3 +1,3 @@
1
1
  module EZAPIClient
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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: 2016-10-11 00:00:00.000000000 Z
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.5.1
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: