privatbank 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f9b16d95ce52d90e7dd14a8f02772d29e9fc134c
4
+ data.tar.gz: 15645d623b673158795b30f7bcbbb5989b6772cd
5
+ SHA512:
6
+ metadata.gz: b85d5627ede60a681f259c790903e114f4c7131b29ea36701239cb9776f33f81f7aaead4d7659bd4be4598773b25429772dd9ea2f84f0d2113e2a6597863d64d
7
+ data.tar.gz: 3a456126a87f16075ee9f49d7a7dd692adbcfe8bd3a02ad84db1818a9e363f09f29ce66b31ec5dfdadc50e176044527824d67db8b1cb2089e37f5284490bffb5
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in privatbank.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Roman Greshny
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # Privatbank
2
+
3
+ Privatbank API wrapper
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'privatbank'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install privatbank
20
+
21
+ ## Usage
22
+
23
+ For usage privat24 you need to [get credentials](https://api.privatbank.ua/manual_reg_fiz.pptx)
24
+
25
+ ```ruby
26
+ require 'privatbank'
27
+
28
+ Privatbank.configure do |config|
29
+ config.merchant_id = 'your-merchant-id'
30
+ config.merchand_password = 'your-merchant-password'
31
+ end
32
+ ```
33
+
34
+ #### Account statement
35
+
36
+ For getting statement of account:
37
+
38
+ ```ruby
39
+ require 'privatbank/p24'
40
+
41
+ from_date = DateTime.parse('2014-11-01')
42
+ till_date = DateTime.parse('2014-11-30')
43
+ card_num = '1111222233334444'
44
+
45
+ Privatbank::P24.account_statement card_number, from_date: from_date, till_date: till_date
46
+ # => [{:date=>"2014-10-02",
47
+ # :time=>"00:00:00",
48
+ # :amount=>"331.63 UAH",
49
+ # :card_amount=>"-331.63 UAH",
50
+ # :rest=>"-441.63 UAH",
51
+ # :description=>"Products: METRO",
52
+ # :transaction_id=>"123"},
53
+ # {:date=>"2014-10-01",
54
+ # :time=>"13:12:36",
55
+ # :amount=>"10.57 UAH",
56
+ # :card_amount=>"10.57 UAH",
57
+ # :rest=>"0.00 UAH",
58
+ # :description=>"Withdraw",
59
+ # :transaction_id=>"321"}]
60
+ ```
61
+
62
+ #### Currency Exchange
63
+
64
+ ```ruby
65
+ require 'privatbank/p24/exchange_rates'
66
+
67
+ Privatbank::P24::ExchangeRates.nbu
68
+
69
+ Privatbank::P24::ExchangeRates.cash
70
+
71
+ Privatbank::P24::ExchangeRates.card
72
+
73
+ # => [{"ccy"=>"RUR", "base_ccy"=>"UAH", "buy"=>"0.32323", "sale"=>"0.32323"},
74
+ # {"ccy"=>"EUR", "base_ccy"=>"UAH", "buy"=>"18.92918", "sale"=>"18.92918"},
75
+ # {"ccy"=>"USD", "base_ccy"=>"UAH", "buy"=>"15.09624", "sale"=>"15.09624"}]
76
+ ```
77
+
78
+ ## Contributing
79
+
80
+ 1. Fork it ( https://github.com/greshny/privatbank/fork )
81
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
82
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
83
+ 4. Push to the branch (`git push origin my-new-feature`)
84
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ end
7
+
8
+ task :default => :test
9
+
@@ -0,0 +1,11 @@
1
+ module Privatbank
2
+ class Configuration
3
+
4
+ attr_accessor :merchant_id, :merchant_password
5
+
6
+ def [](value)
7
+ self.public_send(value)
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,85 @@
1
+ require 'date'
2
+ require 'builder'
3
+ require 'privatbank/p24/items/transaction'
4
+ require 'privatbank/signature'
5
+ require 'httparty'
6
+
7
+ module Privatbank
8
+ module P24
9
+ class AccountStatement
10
+
11
+ include HTTParty
12
+
13
+ base_uri 'https://api.privatbank.ua'
14
+
15
+ def initialize card_number, options={}
16
+ @card_number = card_number
17
+ @from_date = options[:from_date]
18
+ @till_date = options[:till_date]
19
+ @merchant_id = options[:merchant_id]
20
+ @merchant_password = options[:merchant_password]
21
+ end
22
+
23
+ def request
24
+ response = self.class.post('/p24api/rest_fiz', body: outgoing_xml)
25
+ return [] if response.fetch('error', nil)
26
+ response['response']['data']['info']['statements']['statement'].map do |operation|
27
+ Items::Transaction.new( date: operation['trandate'],
28
+ time: operation['trantime'],
29
+ amount: operation['amount'],
30
+ card_amount: operation['cardamount'],
31
+ rest: operation['rest'],
32
+ description: operation['terminal'],
33
+ transaction_id: operation['appcode'])
34
+ end
35
+ end
36
+
37
+ def outgoing_xml
38
+ builder = Builder::XmlMarkup.new
39
+ builder.instruct!
40
+ builder.request(version: '1.0') do |req|
41
+ req.merchant do |merch|
42
+ merch.id(@merchant_id)
43
+ merch.signature(signature)
44
+ end
45
+ req.data do |d|
46
+ d.oper('cmt')
47
+ d.wait(0)
48
+ d.payment(id: '') do |p|
49
+ p.prop(name: 'sd', value: from_date)
50
+ p.prop(name: 'ed', value: till_date)
51
+ p.prop(name: 'card', value: @card_number)
52
+ end
53
+ end
54
+ end
55
+ builder.target!
56
+ end
57
+
58
+ def request_xml_data
59
+ builder = Builder::XmlMarkup.new
60
+ builder.oper('cmt')
61
+ builder.wait(0)
62
+ builder.payment(id: '') do |p|
63
+ p.prop(name: 'sd', value: from_date)
64
+ p.prop(name: 'ed', value: till_date)
65
+ p.prop(name: 'card', value: @card_number)
66
+ end
67
+ builder.target!
68
+ end
69
+
70
+ def signature
71
+ Privatbank::Signature.generate(request_xml_data, @merchant_password)
72
+ end
73
+
74
+
75
+ def from_date
76
+ @from_date.strftime('%d.%m.%Y')
77
+ end
78
+
79
+ def till_date
80
+ @till_date.strftime('%d.%m.%Y')
81
+ end
82
+
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,35 @@
1
+ require 'httparty'
2
+ require 'privatbank/p24/items/exchanges'
3
+
4
+ module Privatbank
5
+ module P24
6
+ class ExchangeRates
7
+ include HTTParty
8
+
9
+ base_uri 'https://api.privatbank.ua/p24api/'
10
+
11
+ class << self
12
+ def cash
13
+ parse get('/pubinfo?exchange&coursid=5')
14
+ end
15
+
16
+ def card
17
+ parse get('/pubinfo?cardExchange')
18
+ end
19
+
20
+ def nbu
21
+ parse get('/pubinfo?exchange&coursid=3')
22
+ end
23
+
24
+ private
25
+
26
+ def parse resp
27
+ resp.parsed_response['exchangerates']['row'].map do |rate|
28
+ Items::Exchanges.new rate['exchangerate']
29
+ end
30
+ end
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,10 @@
1
+ require 'hashie'
2
+
3
+ module Privatbank
4
+ module P24
5
+ module Items
6
+ class Exchanges < Hashie::Mash
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,19 @@
1
+ require 'hashie'
2
+
3
+ module Privatbank
4
+ module P24
5
+
6
+ module Items
7
+ class Transaction < Hashie::Dash
8
+ property :transaction_id
9
+ property :date
10
+ property :time
11
+ property :amount
12
+ property :card_amount
13
+ property :rest
14
+ property :description
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ require 'privatbank/p24/account_statement'
2
+
3
+ module Privatbank
4
+ module P24
5
+
6
+ def self.account_statement card_number, options
7
+ options.merge!(merchant_id: Privatbank.configuration.merchant_id,
8
+ merchant_password: Privatbank.configuration.merchant_password)
9
+ AccountStatement.new(card_number, options).request
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ require 'digest/md5'
2
+ require 'digest/sha1'
3
+
4
+ module Privatbank
5
+ module Signature extend self
6
+
7
+ def generate data, password
8
+ Digest::SHA1.hexdigest md5_hash(data, password)
9
+ end
10
+
11
+ private
12
+
13
+ def md5_hash(data, password)
14
+ Digest::MD5.hexdigest(data.strip + password)
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ module Privatbank
2
+ VERSION = '0.0.1'
3
+ end
data/lib/privatbank.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'privatbank/version'
2
+ require 'privatbank/configuration'
3
+
4
+ module Privatbank
5
+
6
+ class << self
7
+ attr_accessor :configuration
8
+ end
9
+
10
+ def self.configuration
11
+ @configuration ||= Configuration.new
12
+ end
13
+
14
+ def self.configure
15
+ yield(configuration)
16
+ end
17
+
18
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'privatbank/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'privatbank'
8
+ spec.version = Privatbank::VERSION
9
+ spec.authors = ['Roman Greshny']
10
+ spec.email = ['greshny@gmail.com']
11
+ spec.summary = %q{Privat24 API wrapper}
12
+ spec.description = %q{Privat24 API wrapper}
13
+ spec.homepage = 'http://github.com/greshny/privatbank'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'hashie'
22
+ spec.add_dependency 'builder'
23
+ spec.add_dependency 'httparty'
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.7'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'minitest', '~> 4.7.5'
28
+ spec.add_development_dependency 'pry-byebug'
29
+ spec.add_development_dependency 'vcr'
30
+ spec.add_development_dependency 'webmock'
31
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'privatbank'
3
+
4
+ require 'minitest/autorun'
5
+ require 'pry'
6
+
7
+ require 'vcr'
8
+
9
+ VCR.configure do |c|
10
+ c.cassette_library_dir = 'test/vcr_cassettes'
11
+ c.hook_into :webmock
12
+ end
@@ -0,0 +1,24 @@
1
+ require 'minitest_helper'
2
+ require 'privatbank/p24/exchange_rates'
3
+
4
+ class TestExchangeRates < MiniTest::Unit::TestCase
5
+
6
+ def test_cash_exchange
7
+ VCR.insert_cassette 'cash_exchange'
8
+ assert_equal 3, Privatbank::P24::ExchangeRates.cash.count
9
+ VCR.eject_cassette 'cash_exchange'
10
+ end
11
+
12
+ def test_card_exchange
13
+ VCR.insert_cassette 'card_exchange'
14
+ assert_equal 3, Privatbank::P24::ExchangeRates.card.count
15
+ VCR.eject_cassette 'card_exchange'
16
+ end
17
+
18
+ def test_nbu_exchange
19
+ VCR.insert_cassette 'nbu_exchange'
20
+ assert_equal 3, Privatbank::P24::ExchangeRates.nbu.count
21
+ VCR.eject_cassette 'nbu_exchange'
22
+ end
23
+
24
+ end
data/test/test_p24.rb ADDED
@@ -0,0 +1,27 @@
1
+ require 'minitest_helper'
2
+
3
+ Privatbank.configure do |config|
4
+ config.merchant_id = 'some-id-of-merchant'
5
+ config.merchant_password = 'some-secret-password'
6
+ end
7
+
8
+ require 'privatbank/p24'
9
+
10
+ class TestP24 < MiniTest::Unit::TestCase
11
+
12
+ def test_account_statement
13
+ VCR.insert_cassette 'account_statement'
14
+
15
+ card_number = '1111222233334444'
16
+ from_date = DateTime.parse('2001-01-01')
17
+ till_date = DateTime.parse('2002-01-01')
18
+
19
+ options = { card_number: card_number,
20
+ from_date: from_date,
21
+ till_date: till_date }
22
+
23
+ assert_equal true, Privatbank::P24.account_statement(card_number, options) != ''
24
+
25
+ VCR.eject_cassette 'account_statement'
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ require 'minitest_helper'
2
+ require 'privatbank/p24/account_statement'
3
+
4
+ class TestP24AccountStatement < MiniTest::Unit::TestCase
5
+
6
+ def test_outgoing_xml
7
+ merchant_id = 'some-id-of-merchant'
8
+ merchant_password = 'some-secret-password'
9
+ card_number = '1111222233334444'
10
+ from_date = DateTime.parse('2001-01-01')
11
+ till_date = DateTime.parse('2002-01-01')
12
+
13
+ options = {
14
+ merchant_id: merchant_id,
15
+ merchant_password: merchant_password,
16
+ card_number: card_number,
17
+ from_date: from_date,
18
+ till_date: till_date
19
+ }
20
+
21
+ as = Privatbank::P24::AccountStatement.new(card_number, options)
22
+ assert_equal true, as.outgoing_xml != ''
23
+ end
24
+
25
+ end
@@ -0,0 +1,36 @@
1
+ require 'minitest_helper'
2
+
3
+ class TestPrivatbank < MiniTest::Unit::TestCase
4
+
5
+ def test_that_it_has_a_version_number
6
+ refute_nil ::Privatbank::VERSION
7
+ end
8
+
9
+ def test_configure_block
10
+ Privatbank.configure do |config|
11
+ config.merchant_id = 'merchant_identifier'
12
+ config.merchant_password = 'secret'
13
+ end
14
+
15
+ assert_equal 'merchant_identifier', Privatbank.configuration.merchant_id
16
+ assert_equal 'secret', Privatbank.configuration.merchant_password
17
+
18
+ assert_equal 'merchant_identifier', Privatbank.configuration[:merchant_id]
19
+ assert_equal 'secret', Privatbank.configuration[:merchant_password]
20
+ end
21
+
22
+ def test_configure_set_not_exists_attribute
23
+ assert_raises NoMethodError do
24
+ Privatbank.configure do |config|
25
+ config.unknown_attribute = 'something'
26
+ end
27
+ end
28
+ end
29
+
30
+ def test_configure_get_not_exists_attribute
31
+ assert_raises NoMethodError do
32
+ Privatbank.configuration.unknown_attribute
33
+ end
34
+ end
35
+
36
+ end
@@ -0,0 +1,20 @@
1
+ require 'minitest_helper'
2
+ require 'privatbank/signature'
3
+
4
+ class TestSignature < MiniTest::Unit::TestCase
5
+
6
+ def test_signature_generate_with_spaces
7
+ password = 'secret'
8
+ data = ' <xml><data>data</data></xml> '
9
+ assert_equal 'd6cef1996732a32ccecdfd5a22dd56a3ee50afb9',
10
+ Privatbank::Signature.generate(data, password)
11
+ end
12
+
13
+ def test_signature_generate_without_spaces
14
+ password = 'secret'
15
+ data = '<xml><data>data</data></xml>'
16
+ assert_equal 'd6cef1996732a32ccecdfd5a22dd56a3ee50afb9',
17
+ Privatbank::Signature.generate(data, password)
18
+ end
19
+
20
+ end
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.privatbank.ua/p24api/rest_fiz
6
+ body:
7
+ encoding: UTF-8
8
+ string: <?xml version="1.0" encoding="UTF-8"?><request version="1.0"><merchant><id>some-id-of-merchant</id><signature>bafe41ad4d7ed743b57b7ec0af6e486ee94ef396</signature></merchant><data><oper>cmt</oper><wait>0</wait><payment
9
+ id=""><prop name="sd" value="01.01.2001"/><prop name="ed" value="01.01.2002"/><prop
10
+ name="card" value="1111222233334444"/></payment></data></request>
11
+ headers:
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ User-Agent:
17
+ - Ruby
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Sat, 22 Nov 2014 15:34:45 GMT
27
+ Content-Type:
28
+ - text/xml; charset=UTF-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: '<error>For input string: "some-id-of-merchant"</error>'
36
+ http_version:
37
+ recorded_at: Sat, 22 Nov 2014 15:34:45 GMT
38
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.privatbank.ua/p24api/pubinfo?cardExchange
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Sat, 22 Nov 2014 15:32:44 GMT
25
+ Content-Type:
26
+ - text/xml; charset=UTF-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: <?xml version="1.0" encoding="UTF-8"?><exchangerates><row><exchangerate
34
+ ccy="RUR" base_ccy="UAH" buy="0.33000" sale="0.3600"/></row><row><exchangerate
35
+ ccy="EUR" base_ccy="UAH" buy="19.30000" sale="20.12"/></row><row><exchangerate
36
+ ccy="USD" base_ccy="UAH" buy="15.50000" sale="16.05"/></row></exchangerates>
37
+ http_version:
38
+ recorded_at: Sat, 22 Nov 2014 15:32:44 GMT
39
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.privatbank.ua/p24api/pubinfo?coursid=5&exchange
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Sat, 22 Nov 2014 15:32:44 GMT
25
+ Content-Type:
26
+ - text/xml; charset=UTF-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: <?xml version="1.0" encoding="UTF-8"?><exchangerates><row><exchangerate
34
+ ccy="RUR" base_ccy="UAH" buy="0.33000" sale="0.36000"/></row><row><exchangerate
35
+ ccy="EUR" base_ccy="UAH" buy="19.30000" sale="20.10000"/></row><row><exchangerate
36
+ ccy="USD" base_ccy="UAH" buy="15.50000" sale="15.80000"/></row></exchangerates>
37
+ http_version:
38
+ recorded_at: Sat, 22 Nov 2014 15:32:44 GMT
39
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.privatbank.ua/p24api/pubinfo?coursid=3&exchange
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Sat, 22 Nov 2014 15:32:43 GMT
25
+ Content-Type:
26
+ - text/xml; charset=UTF-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: <?xml version="1.0" encoding="UTF-8"?><exchangerates><row><exchangerate
34
+ ccy="RUR" base_ccy="UAH" buy="0.32323" sale="0.32323"/></row><row><exchangerate
35
+ ccy="EUR" base_ccy="UAH" buy="18.92918" sale="18.92918"/></row><row><exchangerate
36
+ ccy="USD" base_ccy="UAH" buy="15.09624" sale="15.09624"/></row></exchangerates>
37
+ http_version:
38
+ recorded_at: Sat, 22 Nov 2014 15:32:43 GMT
39
+ recorded_with: VCR 2.9.3
metadata ADDED
@@ -0,0 +1,206 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: privatbank
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Roman Greshny
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hashie
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: builder
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: httparty
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 4.7.5
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 4.7.5
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry-byebug
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: vcr
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: webmock
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: Privat24 API wrapper
140
+ email:
141
+ - greshny@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".gitignore"
147
+ - ".travis.yml"
148
+ - Gemfile
149
+ - LICENSE.txt
150
+ - README.md
151
+ - Rakefile
152
+ - lib/privatbank.rb
153
+ - lib/privatbank/configuration.rb
154
+ - lib/privatbank/p24.rb
155
+ - lib/privatbank/p24/account_statement.rb
156
+ - lib/privatbank/p24/exchange_rates.rb
157
+ - lib/privatbank/p24/items/exchanges.rb
158
+ - lib/privatbank/p24/items/transaction.rb
159
+ - lib/privatbank/signature.rb
160
+ - lib/privatbank/version.rb
161
+ - privatbank.gemspec
162
+ - test/minitest_helper.rb
163
+ - test/test_exchange_rates.rb
164
+ - test/test_p24.rb
165
+ - test/test_p24_account_statement.rb
166
+ - test/test_privatbank.rb
167
+ - test/test_signature.rb
168
+ - test/vcr_cassettes/account_statement.yml
169
+ - test/vcr_cassettes/card_exchange.yml
170
+ - test/vcr_cassettes/cash_exchange.yml
171
+ - test/vcr_cassettes/nbu_exchange.yml
172
+ homepage: http://github.com/greshny/privatbank
173
+ licenses:
174
+ - MIT
175
+ metadata: {}
176
+ post_install_message:
177
+ rdoc_options: []
178
+ require_paths:
179
+ - lib
180
+ required_ruby_version: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ required_rubygems_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ requirements: []
191
+ rubyforge_project:
192
+ rubygems_version: 2.2.2
193
+ signing_key:
194
+ specification_version: 4
195
+ summary: Privat24 API wrapper
196
+ test_files:
197
+ - test/minitest_helper.rb
198
+ - test/test_exchange_rates.rb
199
+ - test/test_p24.rb
200
+ - test/test_p24_account_statement.rb
201
+ - test/test_privatbank.rb
202
+ - test/test_signature.rb
203
+ - test/vcr_cassettes/account_statement.yml
204
+ - test/vcr_cassettes/card_exchange.yml
205
+ - test/vcr_cassettes/cash_exchange.yml
206
+ - test/vcr_cassettes/nbu_exchange.yml