pina 0.8.1 → 0.9.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 +4 -4
- data/README.md +53 -0
- data/lib/pina.rb +1 -0
- data/lib/pina/collections/my_bank_account.rb +7 -0
- data/lib/pina/models/my_bank_account.rb +62 -0
- data/lib/pina/my_bank_account.rb +63 -0
- data/lib/pina/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e39da309aa0116522c4409d93ecd7210614e90f9
|
4
|
+
data.tar.gz: 32906d34c74d67a52c49fb3b6c197030e67663ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48df18383896fa70ecd5adc18b1960ceddd54b807ebbbbc80464ac618fde58df45e89d8465f03fd9f7017e8fc70ff5a4174a6b8d3ac1b91fd910f32db0002b88
|
7
|
+
data.tar.gz: a65f4fe4ed69a858f4c2b888966d272392854d500a0403725da640c7c3d8cd8ba6aaf2b16caca3244636157c7d6fd087b7f4d35e09889119b759dc16418ffebc
|
data/README.md
CHANGED
@@ -220,6 +220,59 @@ Pina::ProcessedDocument.find(gid)
|
|
220
220
|
Pina::ProcessedDocument.delete(gid)
|
221
221
|
```
|
222
222
|
|
223
|
+
### MyBankAccounts
|
224
|
+
|
225
|
+
#### All my bank accoutns
|
226
|
+
|
227
|
+
```ruby
|
228
|
+
Pina::MyBankAccount.all
|
229
|
+
```
|
230
|
+
|
231
|
+
Gets all bank accounts from your database. Results are paginated and you can access
|
232
|
+
first, next or previous page like this:
|
233
|
+
|
234
|
+
```ruby
|
235
|
+
bank_accounts = Pina::MyBankAccount.all
|
236
|
+
bank_accounts.next_page
|
237
|
+
```
|
238
|
+
|
239
|
+
```ruby
|
240
|
+
bank_accounts = Pina::MyBankAccount.all
|
241
|
+
bank_accounts.previous_page
|
242
|
+
|
243
|
+
bank_accounts.first_page
|
244
|
+
```
|
245
|
+
|
246
|
+
#### Fetching specific bank account
|
247
|
+
|
248
|
+
```ruby
|
249
|
+
Pina::MyBankAccount.find('csob_czk')
|
250
|
+
```
|
251
|
+
|
252
|
+
This ID you can find under attribute `bank_account_id`
|
253
|
+
|
254
|
+
|
255
|
+
#### Create new MyBankAccount
|
256
|
+
|
257
|
+
```ruby
|
258
|
+
params = {
|
259
|
+
bank_account: 'XXXXXXXXX/XXXX',
|
260
|
+
currency_id: 'CZK',
|
261
|
+
bank_account_id: 'XXXX'
|
262
|
+
}
|
263
|
+
|
264
|
+
bank_account = Pina::Models::MyBankAccount.new(params)
|
265
|
+
Pina::MyBankAccount.create(bank_account)
|
266
|
+
```
|
267
|
+
|
268
|
+
#### Update existing bank account
|
269
|
+
|
270
|
+
```ruby
|
271
|
+
bank_account = Pina::MyBankAccount.find('existing')
|
272
|
+
bank_account.download_type = 'none'
|
273
|
+
Pina::MyBankAccount.update('existing', bank_account)
|
274
|
+
```
|
275
|
+
|
223
276
|
## Development
|
224
277
|
|
225
278
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/pina.rb
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
module Pina
|
2
|
+
module Models
|
3
|
+
class MyBankAccount
|
4
|
+
include Virtus.model
|
5
|
+
|
6
|
+
attribute :created_at
|
7
|
+
attribute :updated_at
|
8
|
+
attribute :creator
|
9
|
+
attribute :creator_id
|
10
|
+
attribute :modifier
|
11
|
+
attribute :modifier_id
|
12
|
+
attribute :opening_balance_date
|
13
|
+
attribute :bank_account
|
14
|
+
attribute :bank_account_id
|
15
|
+
attribute :bank_code
|
16
|
+
attribute :country
|
17
|
+
attribute :country_id
|
18
|
+
attribute :currency
|
19
|
+
attribute :currency_id
|
20
|
+
attribute :statement_download_interval
|
21
|
+
attribute :statement_download_type
|
22
|
+
attribute :order_type
|
23
|
+
attribute :statement_encoding
|
24
|
+
attribute :external_id
|
25
|
+
attribute :statement_type
|
26
|
+
attribute :iban
|
27
|
+
attribute :default
|
28
|
+
attribute :hidden
|
29
|
+
attribute :officially_published
|
30
|
+
attribute :send_order_to_bank
|
31
|
+
attribute :download_type
|
32
|
+
|
33
|
+
def creator=(value)
|
34
|
+
return unless value
|
35
|
+
|
36
|
+
self.creator_id = value.values[0]
|
37
|
+
super
|
38
|
+
end
|
39
|
+
|
40
|
+
def modifier=(value)
|
41
|
+
return unless value
|
42
|
+
|
43
|
+
self.modifier_id = value.values[0]
|
44
|
+
super
|
45
|
+
end
|
46
|
+
|
47
|
+
def country=(value)
|
48
|
+
return unless value
|
49
|
+
|
50
|
+
self.country_id = value.values[0]
|
51
|
+
super
|
52
|
+
end
|
53
|
+
|
54
|
+
def currency=(value)
|
55
|
+
return unless value
|
56
|
+
|
57
|
+
self.currency_id = value.values[0]
|
58
|
+
super
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'pina/models/my_bank_account'
|
2
|
+
require 'pina/collections/my_bank_account'
|
3
|
+
|
4
|
+
module Pina
|
5
|
+
class MyBankAccount
|
6
|
+
class << self
|
7
|
+
def new(params = nil)
|
8
|
+
Pina::Models::MyBankAccount.new(params)
|
9
|
+
end
|
10
|
+
|
11
|
+
def find(id)
|
12
|
+
response = Pina::RestAdapter.get(:my_bank_accounts, id)
|
13
|
+
|
14
|
+
return Pina::Models::MyBankAccount.new(attributes(response)) if
|
15
|
+
response.ok?
|
16
|
+
|
17
|
+
response
|
18
|
+
end
|
19
|
+
|
20
|
+
def all(page = nil)
|
21
|
+
response = Pina::RestAdapter.get(:my_bank_accounts, page)
|
22
|
+
|
23
|
+
return Pina::Collections::MyBankAccount.new(attributes(response)) if
|
24
|
+
response.ok?
|
25
|
+
|
26
|
+
response
|
27
|
+
end
|
28
|
+
|
29
|
+
def where(hash, page = nil)
|
30
|
+
response = Pina::RestAdapter.get(:my_bank_accounts, hash)
|
31
|
+
|
32
|
+
return Pina::Collections::MyBankAccount.new(attributes(response)) if
|
33
|
+
response.ok?
|
34
|
+
|
35
|
+
response
|
36
|
+
end
|
37
|
+
|
38
|
+
def create(my_bank_account)
|
39
|
+
response = Pina::RestAdapter.post(:my_bank_accounts, my_bank_account)
|
40
|
+
|
41
|
+
return Pina::Models::MyBankAccount.new(attributes(response)) if
|
42
|
+
response.ok?
|
43
|
+
|
44
|
+
response
|
45
|
+
end
|
46
|
+
|
47
|
+
def update(id, my_bank_account)
|
48
|
+
response = Pina::RestAdapter.patch(:my_bank_accounts, id, my_bank_account)
|
49
|
+
|
50
|
+
return Pina::Models::MyBankAccount.new(attributes(response)) if
|
51
|
+
response.ok?
|
52
|
+
|
53
|
+
response
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def attributes(response)
|
59
|
+
response.to_hash.merge(response: response)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/pina/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Hronek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -213,6 +213,7 @@ files:
|
|
213
213
|
- lib/pina.rb
|
214
214
|
- lib/pina/collections/base.rb
|
215
215
|
- lib/pina/collections/contact.rb
|
216
|
+
- lib/pina/collections/my_bank_account.rb
|
216
217
|
- lib/pina/collections/processed_document.rb
|
217
218
|
- lib/pina/collections/receivable.rb
|
218
219
|
- lib/pina/collections/sales_invoice.rb
|
@@ -220,11 +221,13 @@ files:
|
|
220
221
|
- lib/pina/contact.rb
|
221
222
|
- lib/pina/models/address.rb
|
222
223
|
- lib/pina/models/contact.rb
|
224
|
+
- lib/pina/models/my_bank_account.rb
|
223
225
|
- lib/pina/models/processed_document.rb
|
224
226
|
- lib/pina/models/receivable.rb
|
225
227
|
- lib/pina/models/sales_invoice.rb
|
226
228
|
- lib/pina/models/sales_item.rb
|
227
229
|
- lib/pina/models/sales_order.rb
|
230
|
+
- lib/pina/my_bank_account.rb
|
228
231
|
- lib/pina/processed_document.rb
|
229
232
|
- lib/pina/receivable.rb
|
230
233
|
- lib/pina/rest_adapter.rb
|