rus_bank_rails 0.3.4 → 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/README.md +10 -7
- data/lib/rus_bank_rails/acts_as_bank.rb +7 -0
- data/lib/rus_bank_rails/version.rb +1 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +27 -0
- data/test/dummy/log/test.log +2932 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 905819ccb5dc8efc82c04dd40e39edcd8201bd5c
|
4
|
+
data.tar.gz: 9ed1cb53c589d217d9c45c1abd01c7946dbe2a62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d036922420a2af1af99405c128b315305e969f3b753aa31ad2c013faae1f417adc01de4fef31e932d0a75719bc22742c62cf1c1fc246a1075c347f07fa5749bc
|
7
|
+
data.tar.gz: f86302b91ba26265de63cc1e1012da7814a89255208783ca557a091f220923c691585ce77b352ec396f4af15545d32f26d7bf047229a1ffffc6680c8692c67df
|
data/README.md
CHANGED
@@ -29,19 +29,22 @@ Rails-обертка вокруг гема rus_bank - https://github.com/wildDAl
|
|
29
29
|
|
30
30
|
$ rake db:migrate
|
31
31
|
|
32
|
-
На этом все.
|
33
|
-
|
34
|
-
def expire?(bank)
|
35
|
-
bank.updated_at < 1.minute.ago # Например, обновляем все, что старше минуты
|
36
|
-
end
|
37
|
-
|
38
|
-
Подобным образом переопределям любое поведение гема.
|
32
|
+
На этом все.
|
39
33
|
|
40
34
|
Пример использования:
|
41
35
|
|
42
36
|
@bank = Bank.new
|
43
37
|
internal_code = @bank.BicToIntCode(some_bank_bic)
|
44
38
|
|
39
|
+
Далее можно кастомизировать модель по своему усмотрению. Например, в модели можно переопределить поведение тех или иных методов гема. Например, логика определения, требуется ли возвращать банк из базы или тянуть из API ЦБ, построена на том факте, что справочник БИК вступает в действие в 0:00 по московскому времени на всей территории страны. Т.е. если дата обновления записи(по MSK) в бд не текущие сутки, то обновляем ее. Можно поменять эту логику, переопределив метод expire? в app/models/bank.rb своего приложения:
|
40
|
+
|
41
|
+
def expire?
|
42
|
+
self.updated_at < 1.minute.ago # Например, обновляем все, что старше минуты
|
43
|
+
end
|
44
|
+
|
45
|
+
Подобным образом переопределям любое поведение гема.
|
46
|
+
|
47
|
+
|
45
48
|
Описание доступных методов тут - http://rubydoc.info/gems/rus_bank_rails/RusBankRails/ActsAsBank/LocalInstanceMethods
|
46
49
|
|
47
50
|
## Copyright
|
@@ -112,6 +112,13 @@ module RusBankRails
|
|
112
112
|
lics
|
113
113
|
end
|
114
114
|
|
115
|
+
##
|
116
|
+
# Возвращает true, если банк действующий
|
117
|
+
|
118
|
+
def is_active?
|
119
|
+
(self.org_status != "лицензия отозвана") && !(self.get_licences_as_array_of_hashes.empty?)
|
120
|
+
end
|
121
|
+
|
115
122
|
private
|
116
123
|
|
117
124
|
##
|
Binary file
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -2186,3 +2186,30 @@ Migrating to DeleteOldLicFromBanks (20140208123404)
|
|
2186
2186
|
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "banks" ("bic", "created_at", "date_kgr_registration", "fact_adr", "internal_code", "licences", "main_date_reg", "main_reg_number", "org_full_name", "org_name", "org_status", "phones", "reg_code", "reg_number", "ssv_date", "updated_at", "ust_money", "ustav_adr") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)[0m [["bic", "044585216"], ["created_at", Sat, 08 Feb 2014 12:47:51 UTC +00:00], ["date_kgr_registration", Tue, 12 May 1992], ["fact_adr", "125040, г. Москва, ул. Правды, д. 8, корпус 1"], ["internal_code", 450000650], ["licences", "---\n- :l_code: !ruby/string:Nori::StringWithAttributes\n str: !binary |-\n Nw==\n attributes: {}\n :lt: !ruby/string:Nori::StringWithAttributes\n str: !binary |-\n 0JPQtdC90LXRgNCw0LvRjNC90LDRjyDQu9C40YbQtdC90LfQuNGPINC90LAg\n 0L7RgdGD0YnQtdGB0YLQstC70LXQvdC40LUg0LHQsNC90LrQvtCy0YHQutC4\n 0YUg0L7Qv9C10YDQsNGG0LjQuQ==\n attributes: {}\n :l_date: !ruby/object:DateTime 2012-03-15 00:00:00.000000000 +04:00\n"], ["main_date_reg", Fri, 04 Oct 2002], ["main_reg_number", "1027700280937"], ["org_full_name", "Общество с ограниченной ответственностью \"Хоум Кредит энд Финанс Банк\""], ["org_name", "ХКФ БАНК"], ["org_status", "норм."], ["phones", "(495)785-82-25"], ["reg_code", 16], ["reg_number", 316], ["ssv_date", Wed, 10 Nov 2004], ["updated_at", Sat, 08 Feb 2014 12:47:51 UTC +00:00], ["ust_money", 4173000000], ["ustav_adr", "125040, г. Москва, ул. Правды, д. 8, корпус 1"]]
|
2187
2187
|
[1m[35m (0.5ms)[0m commit transaction
|
2188
2188
|
[1m[36mBank Load (0.2ms)[0m [1mSELECT "banks".* FROM "banks"[0m
|
2189
|
+
[1m[36mBank Load (0.4ms)[0m [1mSELECT "banks".* FROM "banks" WHERE "banks"."reg_number" = 3 LIMIT 1[0m
|
2190
|
+
[1m[35mBank Load (0.2ms)[0m SELECT "banks".* FROM "banks" WHERE "banks"."bic" = '044525859' LIMIT 1
|
2191
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
2192
|
+
[1m[35mSQL (2.9ms)[0m UPDATE "banks" SET "updated_at" = ?, "licences" = ? WHERE "banks"."id" = 42 [["updated_at", Sun, 09 Feb 2014 15:10:50 UTC +00:00], ["licences", "--- []\n"]]
|
2193
|
+
[1m[36m (0.4ms)[0m [1mcommit transaction[0m
|
2194
|
+
[1m[35mBank Load (0.2ms)[0m SELECT "banks".* FROM "banks" WHERE "banks"."reg_number" = 1 LIMIT 1
|
2195
|
+
[1m[36mBank Load (0.1ms)[0m [1mSELECT "banks".* FROM "banks" WHERE "banks"."bic" = '044525545' LIMIT 1[0m
|
2196
|
+
[1m[35m (0.1ms)[0m begin transaction
|
2197
|
+
[1m[36mSQL (0.3ms)[0m [1mUPDATE "banks" SET "licences" = ?, "updated_at" = ? WHERE "banks"."id" = 40[0m [["licences", "---\n- :l_code: !ruby/string:Nori::StringWithAttributes\n str: !binary |-\n Mw==\n attributes: {}\n :lt: !ruby/string:Nori::StringWithAttributes\n str: !binary |-\n 0JvQuNGG0LXQvdC30LjRjyDQvdCwINC/0YDQuNCy0LvQtdGH0LXQvdC40LUg\n 0LLQviDQstC60LvQsNC00Ysg0Lgg0YDQsNC30LzQtdGJ0LXQvdC40LUg0LTR\n gNCw0LPQvtGG0LXQvdC90YvRhSDQvNC10YLQsNC70LvQvtCy\n attributes: {}\n :l_date: !ruby/object:DateTime 2007-12-19 23:00:00.000000000 +03:00\n- :l_code: !ruby/string:Nori::StringWithAttributes\n str: !binary |-\n Nw==\n attributes: {}\n :lt: !ruby/string:Nori::StringWithAttributes\n str: !binary |-\n 0JPQtdC90LXRgNCw0LvRjNC90LDRjyDQu9C40YbQtdC90LfQuNGPINC90LAg\n 0L7RgdGD0YnQtdGB0YLQstC70LXQvdC40LUg0LHQsNC90LrQvtCy0YHQutC4\n 0YUg0L7Qv9C10YDQsNGG0LjQuQ==\n attributes: {}\n :l_date: !ruby/object:DateTime 2012-03-23 00:00:00.000000000 +04:00\n"], ["updated_at", Sun, 09 Feb 2014 15:22:00 UTC +00:00]]
|
2198
|
+
[1m[35m (0.4ms)[0m commit transaction
|
2199
|
+
[1m[36mBank Load (0.2ms)[0m [1mSELECT "banks".* FROM "banks" WHERE "banks"."reg_number" = 1 LIMIT 1[0m
|
2200
|
+
[1m[35mBank Load (0.1ms)[0m SELECT "banks".* FROM "banks" WHERE "banks"."bic" = '044525545' LIMIT 1
|
2201
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
2202
|
+
[1m[35mSQL (0.7ms)[0m UPDATE "banks" SET "licences" = ?, "updated_at" = ? WHERE "banks"."id" = 40 [["licences", "---\n- :l_code: !ruby/string:Nori::StringWithAttributes\n str: !binary |-\n Mw==\n attributes: {}\n :lt: !ruby/string:Nori::StringWithAttributes\n str: !binary |-\n 0JvQuNGG0LXQvdC30LjRjyDQvdCwINC/0YDQuNCy0LvQtdGH0LXQvdC40LUg\n 0LLQviDQstC60LvQsNC00Ysg0Lgg0YDQsNC30LzQtdGJ0LXQvdC40LUg0LTR\n gNCw0LPQvtGG0LXQvdC90YvRhSDQvNC10YLQsNC70LvQvtCy\n attributes: {}\n :l_date: !ruby/object:DateTime 2007-12-19 23:00:00.000000000 +03:00\n- :l_code: !ruby/string:Nori::StringWithAttributes\n str: !binary |-\n Nw==\n attributes: {}\n :lt: !ruby/string:Nori::StringWithAttributes\n str: !binary |-\n 0JPQtdC90LXRgNCw0LvRjNC90LDRjyDQu9C40YbQtdC90LfQuNGPINC90LAg\n 0L7RgdGD0YnQtdGB0YLQstC70LXQvdC40LUg0LHQsNC90LrQvtCy0YHQutC4\n 0YUg0L7Qv9C10YDQsNGG0LjQuQ==\n attributes: {}\n :l_date: !ruby/object:DateTime 2012-03-23 00:00:00.000000000 +04:00\n"], ["updated_at", Sun, 09 Feb 2014 15:23:31 UTC +00:00]]
|
2203
|
+
[1m[36m (1.6ms)[0m [1mcommit transaction[0m
|
2204
|
+
[1m[35mBank Load (0.2ms)[0m SELECT "banks".* FROM "banks" WHERE "banks"."reg_number" = 2 LIMIT 1
|
2205
|
+
[1m[36mBank Load (0.1ms)[0m [1mSELECT "banks".* FROM "banks" WHERE "banks"."bic" = '044030869' LIMIT 1[0m
|
2206
|
+
[1m[35m (0.1ms)[0m begin transaction
|
2207
|
+
[1m[36mSQL (0.3ms)[0m [1mUPDATE "banks" SET "licences" = ?, "updated_at" = ? WHERE "banks"."id" = 41[0m [["licences", "---\n- :l_code: !ruby/string:Nori::StringWithAttributes\n str: !binary |-\n Nw==\n attributes: {}\n :lt: !ruby/string:Nori::StringWithAttributes\n str: !binary |-\n 0JPQtdC90LXRgNCw0LvRjNC90LDRjyDQu9C40YbQtdC90LfQuNGPINC90LAg\n 0L7RgdGD0YnQtdGB0YLQstC70LXQvdC40LUg0LHQsNC90LrQvtCy0YHQutC4\n 0YUg0L7Qv9C10YDQsNGG0LjQuQ==\n attributes: {}\n :l_date: !ruby/object:DateTime 2012-09-10 00:00:00.000000000 +04:00\n"], ["updated_at", Sun, 09 Feb 2014 15:30:02 UTC +00:00]]
|
2208
|
+
[1m[35m (0.4ms)[0m commit transaction
|
2209
|
+
[1m[36mBank Load (0.2ms)[0m [1mSELECT "banks".* FROM "banks" WHERE "banks"."reg_number" = 3 LIMIT 1[0m
|
2210
|
+
[1m[35mBank Load (0.1ms)[0m SELECT "banks".* FROM "banks" WHERE "banks"."bic" = '044525859' LIMIT 1
|
2211
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
2212
|
+
[1m[35mSQL (0.3ms)[0m UPDATE "banks" SET "updated_at" = ?, "licences" = ? WHERE "banks"."id" = 42 [["updated_at", Sun, 09 Feb 2014 15:42:31 UTC +00:00], ["licences", "--- []\n"]]
|
2213
|
+
[1m[36m (0.4ms)[0m [1mcommit transaction[0m
|
2214
|
+
[1m[36mBank Load (0.2ms)[0m [1mSELECT "banks".* FROM "banks" WHERE "banks"."bic" = '044525545' LIMIT 1[0m
|
2215
|
+
[1m[35mBank Load (0.2ms)[0m SELECT "banks".* FROM "banks" WHERE "banks"."bic" = '044525859' LIMIT 1
|