pina 0.14.2 → 0.14.3

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
  SHA256:
3
- metadata.gz: 49d876cbc58aac5b8e4add6074ec48e29f5951a639acf85663d6048fda9524e9
4
- data.tar.gz: 7dfd08b5ea35fd8f22ed04e88f528127d2436e2e364e25969183807fc877ae56
3
+ metadata.gz: ff6e594b9c73a20ce3693151ba982ed27e66b9571241bc75b57bcbfa29854afa
4
+ data.tar.gz: 249191684f10fd080ac0cd53f68729203c4bccd8fe19f71795a2b87da3b023cc
5
5
  SHA512:
6
- metadata.gz: 3482730d66a8bb742623d1d3bd3d7f2729fdfd5dfa362cd8d4989b345fbab950e2d638bd7e06845b3d0eb404e5b2f890c7fec3a0a8fd12ea9221b743f53c1eb9
7
- data.tar.gz: e19c41c93b1ceb9713cc248dd8b66bbfc33fadcf4a483a2ad4cfe687f2b532245e9476437d1b1ccd202cc180eaf56a35921b8a68892c9471630bf919377c6a46
6
+ metadata.gz: 92aa7c800628520222e12c9c344ee9d2d71c165364b5476c4b77c464cc23935eec55f40bda293365dd5072ecc186a24464a26788fcc92aa5ea1b0bffc0cdd813
7
+ data.tar.gz: d4fa14b6224fe4c5325fb8b65c3a5737a3ef8440be45cf159c06c601a941063ccb30279328e08af2577fdb7f35aa9afec3794bcd3b2db789e3d3a5c5e560e33f
data/lib/pina.rb CHANGED
@@ -23,6 +23,7 @@ require 'pina/stat_processed_document'
23
23
  require 'pina/my_bank_account'
24
24
  require 'pina/uploaded_document'
25
25
  require 'pina/uploaded_document_pairing'
26
+ require 'pina/document_pairing'
26
27
 
27
28
  module Pina
28
29
  class ConfigurationNotSet < StandardError; end
@@ -0,0 +1,7 @@
1
+ module Pina
2
+ module Collections
3
+ class DocumentPairing < Base
4
+ attribute :items, Array[::Pina::Models::DocumentPairing]
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,23 @@
1
+ require 'pina/models/document_pairing'
2
+ require 'pina/collections/document_pairing'
3
+
4
+ module Pina
5
+ class DocumentPairing
6
+ class << self
7
+ def all(page = nil)
8
+ response = Pina::RestAdapter.get(:document_pairings, page)
9
+
10
+ return Pina::Collections::DocumentPairing.new(attributes(response)) if
11
+ response.ok?
12
+
13
+ response
14
+ end
15
+
16
+ private
17
+
18
+ def attributes(response)
19
+ response.to_hash.merge(response: response)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,42 @@
1
+ require 'pina/models/uploaded_document'
2
+ require 'active_support/inflector'
3
+ require 'active_support/core_ext/hash/keys'
4
+
5
+ module Pina
6
+ module Models
7
+ class DocumentPairing
8
+ include Virtus.model
9
+
10
+ attribute :uploaded_document, ::Pina::Models::UploadedDocument
11
+
12
+ attribute :document_pairable_type
13
+ attribute :document_pairable_id
14
+
15
+ attribute :created_at, DateTime
16
+
17
+ def initialize(attributes = {}, *args)
18
+ extend(Virtus.model)
19
+
20
+ document_type = attributes.symbolize_keys[:document_pairable_type]
21
+ document_pairable_attribute(document_type)
22
+
23
+ super
24
+ end
25
+
26
+ private
27
+
28
+ def document_pairable_attribute(document_type)
29
+ return unless document_type
30
+
31
+ attribute(:document_pairable, document_klass(document_type))
32
+ end
33
+
34
+ def document_klass(document_type)
35
+ model = document_type.camelize
36
+ return unless Pina::Models.const_defined?(model)
37
+
38
+ Pina::Models.const_get(model)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -67,6 +67,7 @@ module Pina
67
67
  attribute :vat2_amount
68
68
  attribute :vat3_amount
69
69
  attribute :vat_document
70
+ attribute :gid
70
71
 
71
72
  def self.to_s
72
73
  'sales_invoice'
data/lib/pina/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pina
2
- VERSION = '0.14.2'.freeze
2
+ VERSION = '0.14.3'.freeze
3
3
  end
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.14.2
4
+ version: 0.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Hronek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-10 00:00:00.000000000 Z
11
+ date: 2019-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -231,6 +231,7 @@ files:
231
231
  - lib/pina.rb
232
232
  - lib/pina/collections/base.rb
233
233
  - lib/pina/collections/contact.rb
234
+ - lib/pina/collections/document_pairing.rb
234
235
  - lib/pina/collections/my_bank_account.rb
235
236
  - lib/pina/collections/petty_cash_disburstment.rb
236
237
  - lib/pina/collections/processed_document.rb
@@ -241,10 +242,12 @@ files:
241
242
  - lib/pina/collections/stat_processed_document.rb
242
243
  - lib/pina/collections/uploaded_document.rb
243
244
  - lib/pina/contact.rb
245
+ - lib/pina/document_pairing.rb
244
246
  - lib/pina/models/address.rb
245
247
  - lib/pina/models/coercions/nested_value.rb
246
248
  - lib/pina/models/contact.rb
247
249
  - lib/pina/models/contact_bank_account.rb
250
+ - lib/pina/models/document_pairing.rb
248
251
  - lib/pina/models/error.rb
249
252
  - lib/pina/models/errors.rb
250
253
  - lib/pina/models/my_bank_account.rb