rus_bank 0.3.0 → 0.6.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: 03420439c48f1501457a11ce51560fb8e85ab634
4
- data.tar.gz: f01587ebd6cbaaccac72cc13f8592bb20184eec9
3
+ metadata.gz: 97c16ed5955b72b7277266c7fd60ae076eb79792
4
+ data.tar.gz: 25c64f341251803164969e0ad62fb86f6286a78f
5
5
  SHA512:
6
- metadata.gz: b1dade2886726260108d79f2e4c640cc5eff973a7573252e729d6935251ff5bf598ff3eb82f2fb0bf97f17e5549394f1124102b5275a3eb1c6d9e2f7984bdae7
7
- data.tar.gz: 62a09d18963429bdbcfe555e2bc92aac98963713d4fc52852166a45ee8ad77a8975a754261916e83bd55cea6ae20082e85a5f524e0c73da1156a45c0494c51d6
6
+ metadata.gz: 643c970a2272f8119a9e420f38a7ce49cea7a748169270560e07a87aaf92f056158531297c57ef41681c4e5aedca80b3e3149eaded8b97ad3b869e43115c32d7
7
+ data.tar.gz: 7ced0a75afabf44648b45a9ebbc4d962ee5b89db9b748172e4797f7330698511d8047781c50c22c820e5746b21272a41e4217102795d1be6c2cc240d3711558c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.6.0
data/lib/rus_bank.rb CHANGED
@@ -20,6 +20,16 @@ class RusBank
20
20
  call(:bic_to_reg_number, params)
21
21
  end
22
22
 
23
+ def RegNumToIntCode(reg_num)
24
+ params = { "RegNumber" => reg_num }
25
+ call(:reg_num_to_int_code, params)
26
+ end
27
+
28
+ def IntCodeToRegNum(int_code)
29
+ params = { "IntNumber" => int_code }
30
+ call(:int_code_to_reg_num, params)
31
+ end
32
+
23
33
  def EnumBicXML
24
34
  response = call(:enum_bic_xml)
25
35
  if response.nil?
@@ -29,6 +39,15 @@ class RusBank
29
39
  end
30
40
  end
31
41
 
42
+ def RegionsEnumXML
43
+ response = call(:regions_enum_xml)
44
+ if response.nil?
45
+ nil
46
+ else
47
+ response[:regions_enum][:rgid]
48
+ end
49
+ end
50
+
32
51
  def CreditInfoByIntCodeXML(internal_code)
33
52
  params = { "InternalCode" => internal_code }
34
53
  response = call(:credit_info_by_int_code_xml, params)
data/rus_bank.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "rus_bank"
8
- s.version = "0.3.0"
8
+ s.version = "0.6.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["wilDAlex"]
12
- s.date = "2013-11-30"
12
+ s.date = "2013-12-23"
13
13
  s.description = "\u{41d}\u{430}\u{431}\u{43e}\u{440} ruby-\u{43c}\u{435}\u{442}\u{43e}\u{434}\u{43e}\u{432} \u{434}\u{43b}\u{44f} \u{440}\u{430}\u{431}\u{43e}\u{442}\u{44b} \u{441} \u{441}\u{435}\u{440}\u{432}\u{438}\u{441}\u{430}\u{43c}\u{438} \u{426}\u{411} \u{420}\u{424}"
14
14
  s.email = "some@wild-x.ru"
15
15
  s.extra_rdoc_files = [
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  "VERSION",
27
27
  "lib/rus_bank.rb",
28
28
  "rus_bank.gemspec",
29
- "test/helper.rb",
29
+ "test/test_helper.rb",
30
30
  "test/test_rus_bank.rb"
31
31
  ]
32
32
  s.homepage = "http://github.com/wildDAlex/rus_bank"
File without changes
@@ -1,7 +1,67 @@
1
- require 'helper'
1
+ require "../test/test_helper"
2
2
 
3
3
  class TestRusBank < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
4
+ #should "probably rename this file and start testing for real" do
5
+ # flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ #end
7
+ #
8
+ context "RusBank" do
9
+ setup do
10
+ @cbr = RusBank.new
11
+ VALID_BIC = "044585216"
12
+ INVALID_BIC = "0445852169999"
13
+ VALID_INT_CODE = "450000650"
14
+ INVALID_INT_CODE = "450000650999999"
15
+ VALID_REG_NUMBER = "316"
16
+ INVALID_REG_NUMBER = "289375237580009"
17
+ VALID_ORG_NAME = "ХКФ БАНК"
18
+ end
19
+
20
+ should "Service return implemented methods" do
21
+ assert_contains(@cbr.operations, :bic_to_int_code)
22
+ assert_contains(@cbr.operations, :bic_to_reg_number)
23
+ assert_contains(@cbr.operations, :enum_bic_xml)
24
+ assert_contains(@cbr.operations, :credit_info_by_int_code_xml)
25
+ end
26
+
27
+ should ":bic_to_int_code return correct value" do
28
+ assert_equal(VALID_INT_CODE, @cbr.BicToIntCode(VALID_BIC))
29
+ assert_equal(nil, @cbr.BicToIntCode(INVALID_BIC), "Should return nil if value not found")
30
+ end
31
+
32
+ should ":bic_to_reg_number return correct value" do
33
+ assert_equal(VALID_REG_NUMBER, @cbr.BicToRegNumber(VALID_BIC))
34
+ assert_equal(nil, @cbr.BicToRegNumber(INVALID_BIC), "Should return nil if value not found")
35
+ end
36
+
37
+ should ":reg_num_to_int_code return correct value" do
38
+ assert_equal(VALID_INT_CODE, @cbr.RegNumToIntCode(VALID_REG_NUMBER))
39
+ assert_equal(nil, @cbr.RegNumToIntCode(INVALID_REG_NUMBER), "Should return nil if value not found")
40
+ end
41
+
42
+ should ":int_code_to_reg_num return correct value" do
43
+ assert_equal(VALID_REG_NUMBER, @cbr.IntCodeToRegNum(VALID_INT_CODE))
44
+ assert_equal(nil, @cbr.IntCodeToRegNum(INVALID_INT_CODE), "Should return nil if value not found")
45
+ end
46
+
47
+ should ":enum_bic_xml returns array of elements" do
48
+ assert(@cbr.EnumBicXML.instance_of?(Array), "This should be array")
49
+ assert(@cbr.EnumBicXML.length > 100, "This should return more than 100 elements")
50
+ end
51
+
52
+ should ":regions_enum_xml returns array of elements" do
53
+ assert(@cbr.RegionsEnumXML.instance_of?(Array), "This should be array")
54
+ assert(@cbr.RegionsEnumXML.length > 70, "This should return more than 70 elements")
55
+ end
56
+
57
+
58
+ should ":credit_info_by_int_code_xml return correct bank" do
59
+ assert_equal(VALID_REG_NUMBER, @cbr.CreditInfoByIntCodeXML(VALID_INT_CODE)[:reg_number])
60
+ assert_equal(VALID_ORG_NAME, @cbr.CreditInfoByIntCodeXML(VALID_INT_CODE)[:org_name])
61
+ assert_equal(VALID_BIC, @cbr.CreditInfoByIntCodeXML(VALID_INT_CODE)[:bic])
62
+ assert_equal(nil, @cbr.CreditInfoByIntCodeXML(INVALID_INT_CODE), "Should return nil if value not found")
63
+ end
64
+
6
65
  end
66
+
7
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rus_bank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - wilDAlex
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-30 00:00:00.000000000 Z
11
+ date: 2013-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -97,7 +97,7 @@ files:
97
97
  - VERSION
98
98
  - lib/rus_bank.rb
99
99
  - rus_bank.gemspec
100
- - test/helper.rb
100
+ - test/test_helper.rb
101
101
  - test/test_rus_bank.rb
102
102
  homepage: http://github.com/wildDAlex/rus_bank
103
103
  licenses: