ezapi_client 1.1.2 → 1.2.1

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
  SHA256:
3
- metadata.gz: d882be4e0e5590767acebaf79f8c69ce59e01a1f9052a5647d362f90f39c0d2e
4
- data.tar.gz: dec359d2614a24b7ca267eb567cb210f8e9761b67bdbb14a3594c67150536dcd
3
+ metadata.gz: 10441c9836b7afdd18c4c547d64256e6cdae629eea322fec9be64e3167935b7e
4
+ data.tar.gz: 71344d9930c0a57a65d60a292717c637b3bf6cdcecfbf059fc4ad3b8143ab987
5
5
  SHA512:
6
- metadata.gz: 8f003b41e4aaaa3c86ad46cc624989ced084135932f42450ba7b3f70bf0e8ff9dfbe5d2eec3ecf3d1ea6db0abf901597ff072c1e9e00c76f58e0f0d48fd6b966
7
- data.tar.gz: de8cb2f6e0d0edb309f264cf5b823b12534ec30f1f471335b8d536bad884390f98dcb79bd889f8a9c61d34f352464bd98402a992e3365d1492977f380501e11b
6
+ metadata.gz: 4382fab44045aad82a36d1c9052da09e87ed11d3b5de32270adcd75febdcbc964195362708aa8e41beaa2060fd44f8a33809efd2e43a66b88562d52119f993b7
7
+ data.tar.gz: a3222630799d3648e7450d8641a5ce17eb8938e2ab8e0e58bbf6956793ea6939452028a41f645f90b2b43f95636c756c81becf13296e0b0833adc8d6cc236139
@@ -0,0 +1,26 @@
1
+ name: CI
2
+
3
+ on: pull_request
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - uses: actions/checkout@v1
11
+ - name: Set up Ruby 2.6
12
+ uses: actions/setup-ruby@v1
13
+ with:
14
+ ruby-version: 2.6.x
15
+ - name: Build and test with Rake
16
+ env:
17
+ USERNAME: z1uc7CukRHDiz5MalmlbQ2YVBSY=
18
+ PASSWORD: ${{secrets.TEST_PASSWORD}}
19
+ EKS_PATH: spec/fixtures/BLO00010.eks
20
+ PRV_PATH: spec/fixtures/BLO00010.prv
21
+ AGENT_CODE: ACE
22
+ HOST: https://apitest.easypadala.com
23
+ run: |
24
+ gem install bundler -v 1.17.3
25
+ bundle install --jobs 4 --retry 3
26
+ bundle exec rake
@@ -2,6 +2,16 @@
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
+ ## [1.2.1] - 2020-01-21
6
+ ### Changed
7
+ - Re-release v1.2.0
8
+
9
+ ## [1.2.0] - 2020-01-20
10
+ ### Changed
11
+ - Enable logging for possible json errors
12
+ ### Fixed
13
+ - Strip special characters when converting string to json
14
+
5
15
  ## [1.1.2] - 2019-09-07
6
16
  ### Changed
7
17
  - Updated `bin/ezapi.jar`
@@ -4,11 +4,11 @@ module EZAPIClient
4
4
  include Virtus.model
5
5
  attribute :command, String
6
6
 
7
- def self.call(command)
8
- self.new(command: command).()
7
+ def self.call(command, logger = nil)
8
+ self.new(command: command).(logger)
9
9
  end
10
10
 
11
- def call
11
+ def call(logger = nil)
12
12
  stdout_str, stderr_str, status = Open3.capture3(command)
13
13
  unless status.success?
14
14
  error_msgs = [
@@ -16,6 +16,7 @@ module EZAPIClient
16
16
  stderr_str,
17
17
  ].reject { |str| str == "" }.compact.join("; ")
18
18
  msg = ["Error executing command:", error_msgs].join(" ")
19
+ logger.error(EZAPIClient::LOG_PROGNAME) { msg } if logger
19
20
  fail ArgumentError, msg
20
21
  end
21
22
  stdout_str.chomp
@@ -1,5 +1,6 @@
1
1
  module EZAPIClient
2
2
  class GenData
3
+ ALLOWED_CHARACTERS = '[^\w\s-]'
3
4
 
4
5
  include Virtus.model
5
6
  attribute :username, String
@@ -20,8 +21,10 @@ module EZAPIClient
20
21
  def call
21
22
  if log
22
23
  logger.info(EZAPIClient::LOG_PROGNAME) { command }
24
+ ExecCommand.(command, logger)
25
+ else
26
+ ExecCommand.(command)
23
27
  end
24
- ExecCommand.(command)
25
28
  end
26
29
 
27
30
  private
@@ -42,9 +45,15 @@ module EZAPIClient
42
45
 
43
46
  def default_json
44
47
  message.each_with_object({}) do |(key, value), hash|
45
- hash[key.to_s.camelcase(:lower)] = value
48
+ hash[key.to_s.camelcase(:lower)] = strip_special_characters(value)
46
49
  end.to_json
47
50
  end
48
51
 
52
+ def strip_special_characters(value)
53
+ return value if !value.is_a?(String)
54
+
55
+ value.gsub(Regexp.new(ALLOWED_CHARACTERS), '')
56
+ end
57
+
49
58
  end
50
59
  end
@@ -1,3 +1,3 @@
1
1
  module EZAPIClient
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.1"
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: 1.1.2
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-09 00:00:00.000000000 Z
11
+ date: 2020-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -172,10 +172,10 @@ extensions: []
172
172
  extra_rdoc_files: []
173
173
  files:
174
174
  - ".env"
175
+ - ".github/workflows/pull_request.yml"
175
176
  - ".gitignore"
176
177
  - ".rspec"
177
178
  - ".ruby-version"
178
- - ".travis.yml"
179
179
  - CHANGELOG.md
180
180
  - CODE_OF_CONDUCT.md
181
181
  - Dockerfile
@@ -1,17 +0,0 @@
1
- sudo: required
2
- services:
3
- - docker
4
- env:
5
- matrix:
6
- - DOCKER_COMPOSE_VERSION=1.14.0
7
- global:
8
- # PASSWORD
9
- - secure: NM4unx0H2iEVdzJrsYgZzXfBXNDkB34nHpU94h+2QjMiQwWeJ5NVOwD2ISrbOc97SCyJbMgJTSYh2E/qotoTVG5yK/6FPnDy542UawLWrFixBhFR0GreSqbJkdZfaTNZ3CBa9Tc+cOmDbdIIh2bzZkrCExxHb5ngOR9yxUQ85f7hYshllrls+ZdL5qphWUpOLGGM6URYBi6P0LaGgkxK6ZQz/W/YS0sk8054y3fyebMu4+J4Ua5aGLBjOs9vB3BVkTmYxQGte93Oi9Fx4/W6/9T0Byyz/kReutxpbbq/e1UEjD7JE7jTtnEIyUzNq37DQixDs0n/3B3r7Ms2s9EgLT0wF0ZNd5CcFydzwCE710/zPG6il17tpeS8wrjpaAVUV4sxWezM52HdARUmWKPJDvzqEskW+QuHqme+JNh4F3/DgltAowl1ssu7oMfdBhCZAgFzPBOwz+5RJp6GaErVhDLw6qgTeeKI/tWAPyUZldA2XjpMMcBsNevwOfDjkcN6aCT2a6c/BGV3yj2XudbdswDkTbHPZMnsQ7GTBHXwUfM1tNdV0cFgZpGxDFLeHTP+W/JYLaMI+cXzpNvfenGldt4xznjHHGjzKvxO+cwUWAjA9KK9FpMyND5jOr7T+e8+OlmH7sX+Oz99+qvQUz2NOyUUIJi+aFa+ImM/CblqdEg=
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