ezapi_client 0.1.0 → 0.2.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: afcd05e247194fdcf5b992a0ea5828cb2eb81b5d
4
- data.tar.gz: 0e858ff16284a01f52084ed84305142d84cacdc1
3
+ metadata.gz: 5112f2a4dfb49a206f6ab6a5b6e3fd43b9c1ce06
4
+ data.tar.gz: 22061841b7a085fc9d7a478e21b7d1219b00b106
5
5
  SHA512:
6
- metadata.gz: 54f6daf693cfe443cd822c3b822d4f119bb3d5d83dd8ee51482f6611b30bbeca51e1fc03474af9b578969d04a9e44dde611b91bbedac617020378a53265c11b3
7
- data.tar.gz: 53407f6bff84850053730464d7e7b2d1d7da3c82e670a74b57f00d6ed121550ea19c8eff7d8a39141dd52f16ae61f36c801479e9eacbde4230533e3ad154cbeb
6
+ metadata.gz: b9de12526f20484cf0c7382c1c091e18f8ba15b729996fdaced18552708bcf075b6e62564fee93080c098a5f3165c8b5704a3e2ac9398d6d39453de36e3e38c5
7
+ data.tar.gz: 1e16c1f3589105450a8bceee54daf88354547792bd05cd92687c87a70518b8bbf69108859a8d8163e72ca1c7594e3add37963d16624406729aacf0b06603e1b9
@@ -2,6 +2,11 @@
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.2.0] - 2016-08-25
6
+ ### Changed
7
+ - Update `trans_date` to new required format (`2016-08-23 15:30:05 +0800`)
8
+ - Require `bank_code`, `branch_name`, `account_no` only if bank transaction
9
+
5
10
  ## [0.1.0] - 2016-08-22
6
11
  ### Added
7
12
  - Initial working version
@@ -0,0 +1,17 @@
1
+ FROM ruby:2.3.0
2
+ RUN apt-get update -qq
3
+ RUN apt-get upgrade -y
4
+ RUN apt-get install -y build-essential libpq-dev nodejs postgresql-client openjdk-7-jre
5
+ RUN mkdir /app
6
+ WORKDIR /app
7
+
8
+ ENV BUNDLE_GEMFILE=/app/Gemfile \
9
+ BUNDLE_JOBS=2 \
10
+ BUNDLE_PATH=/bundle \
11
+ GEM_HOME=/bundle
12
+
13
+ RUN gem install bundler
14
+
15
+ ENV PATH=./bin:$PATH
16
+
17
+ ADD . /app
data/README.md CHANGED
@@ -25,7 +25,10 @@ See `spec/functional` for examples.
25
25
  ## Development
26
26
 
27
27
  1. Copy `spec/config.yml.sample` to `spec/config.yml` and fill up with your own details.
28
- 2. `rspec spec`
28
+ 2. `docker-compose build`
29
+ 3. `docker-compose run app rspec`
30
+
31
+ 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.
29
32
 
30
33
  ## Contributing
31
34
 
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rspec' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("rspec-core", "rspec")
@@ -0,0 +1,16 @@
1
+ version: '2'
2
+ services:
3
+ app:
4
+ build: .
5
+ volumes_from:
6
+ - bundle
7
+ volumes:
8
+ - .:/app
9
+ - ../:/src
10
+ bundle:
11
+ image: busybox
12
+ volumes:
13
+ - /bundle
14
+ volumes:
15
+ bundle:
16
+ src:
@@ -25,7 +25,7 @@ module EZAPIClient
25
25
  }
26
26
 
27
27
  attribute :reference_no, String
28
- attribute :trans_date, Date
28
+ attribute :trans_date, DateTime
29
29
  attribute :sender_lastname, String
30
30
  attribute :sender_firstname, String
31
31
  attribute :sender_middle_name, String
@@ -70,7 +70,6 @@ module EZAPIClient
70
70
  def default_data
71
71
  message = %i[
72
72
  reference_no
73
- trans_date
74
73
  sender_lastname
75
74
  sender_firstname
76
75
  sender_middle_name
@@ -94,6 +93,7 @@ module EZAPIClient
94
93
  message1
95
94
  message2
96
95
  ].each_with_object({}) { |attr, hash| hash[attr] = send(attr) }
96
+ message[:trans_date] = trans_date.strftime("%Y-%m-%d %H:%M:%S %z")
97
97
 
98
98
  GenData.(
99
99
  username: username,
@@ -1,8 +1,10 @@
1
1
  module EZAPIClient
2
2
  CreateTransactionRequestSchema = Dry::Validation.Schema(BaseSchema) do
3
3
 
4
+ BANK_TRANS_TYPE = "CBA"
5
+
4
6
  required(:reference_no).filled(:str?, max_size?: 20)
5
- required(:trans_date).filled(:date?)
7
+ required(:trans_date).filled(:date_time?)
6
8
  required(:sender_lastname).filled(:str?, max_size?: 40)
7
9
  required(:sender_firstname).filled(:str?, max_size?: 40)
8
10
  required(:sender_middle_name).maybe(:str?, max_size?: 1)
@@ -21,9 +23,9 @@ module EZAPIClient
21
23
  max_size?: 3,
22
24
  included_in?: CreateTransactionRequest::TRANS_TYPES.keys,
23
25
  })
24
- required(:bank_code).filled(:str?, max_size?: 5)
25
- required(:branch_name).filled(:str?, max_size?: 40)
26
- required(:account_no).filled(:str?, max_size?: 20)
26
+ required(:bank_code).maybe(:str?, max_size?: 5)
27
+ required(:branch_name).maybe(:str?, max_size?: 40)
28
+ required(:account_no).maybe(:str?, max_size?: 20)
27
29
  required(:landed_currency).filled(:str?, {
28
30
  max_size?: 3,
29
31
  included_in?: %w(USD PHP),
@@ -40,6 +42,22 @@ module EZAPIClient
40
42
  trans_type.included_in?(trans_types).then(recipient_birthday.filled?)
41
43
  end
42
44
 
45
+ rule(bank_code_presence: %i[trans_type bank_code]) do |trans_type, bank_code|
46
+ trans_type.eql?(BANK_TRANS_TYPE).then(bank_code.filled?)
47
+ end
48
+
49
+ rule(
50
+ branch_name_presence: %i[trans_type branch_name]
51
+ ) do |trans_type, branch_name|
52
+ trans_type.eql?(BANK_TRANS_TYPE).then(branch_name.filled?)
53
+ end
54
+
55
+ rule(
56
+ account_no_presence: %i[trans_type account_no]
57
+ ) do |trans_type, account_no|
58
+ trans_type.eql?(BANK_TRANS_TYPE).then(account_no.filled?)
59
+ end
60
+
43
61
  rule(
44
62
  recipient_phone_presence: %i[trans_type recipient_phone]
45
63
  ) do |trans_type, recipient_phone|
@@ -1,3 +1,3 @@
1
1
  module EZAPIClient
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.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.1.0
4
+ version: 0.2.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-08-22 00:00:00.000000000 Z
11
+ date: 2016-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -162,12 +162,15 @@ files:
162
162
  - ".travis.yml"
163
163
  - CHANGELOG.md
164
164
  - CODE_OF_CONDUCT.md
165
+ - Dockerfile
165
166
  - Gemfile
166
167
  - LICENSE.txt
167
168
  - README.md
168
169
  - Rakefile
169
170
  - bin/console
171
+ - bin/rspec
170
172
  - bin/setup
173
+ - docker-compose.yml
171
174
  - ezapi_client.gemspec
172
175
  - lib/ezapi_client.rb
173
176
  - lib/ezapi_client/bin/ezapi.jar
@@ -210,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
213
  version: '0'
211
214
  requirements: []
212
215
  rubyforge_project:
213
- rubygems_version: 2.6.4
216
+ rubygems_version: 2.5.1
214
217
  signing_key:
215
218
  specification_version: 4
216
219
  summary: Ruby wrapper for EZAPI