hws-transactions 0.1.0 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1205ba882568d97a1a6443a6a3d3dbcf885e7449c985658e29da4b81d2ac8527
4
- data.tar.gz: 5e28853389dc197feb0fdf12d417e82792f3f91f971e8d4734e7b686882802f0
3
+ metadata.gz: 355de16d7149038ec235c7b8af247d1c233591a6a146787de4ca73e0a6ec208b
4
+ data.tar.gz: 5ce99f18022e2c562027f72252f073adc9097eaa885f161594bfd23e4da5f63e
5
5
  SHA512:
6
- metadata.gz: a9d4888fd58c53a6e7cdb3a56f073b1cf47f2a7e84b2e88ba1dee7a5e07be83924b445540250f32da552fafc3a489e180c422570a4fbc61b18abb97c0524eafd
7
- data.tar.gz: bbd70d2ffcd3302bdb34177ecb813a0d7b151db7251deb74a73700bee172e5a32e84f14cedf3eace725aee769e0ec743c8609fc36759b79049da76adfc50088d
6
+ metadata.gz: ca139e9ea189a3e733f815a2f42ec64dea5f3a421b120d0b96d366f131bb308593e445a691ec01e4075bda08e41c7dc2e622365d140b33041a304d1025eb3693
7
+ data.tar.gz: 0d2c75354daca587b19df1cc0ea9c9f4d7225dad433ada917bdac467aa5b3ed095c1eeaad7885d263c3677b58235cd1084a9675aa80da177260e505035687488
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ## [Unreleased]
2
+ ## [0.1.1] - 2021-12-16
2
3
 
4
+ - Expose get_entry method
3
5
  ## [0.1.0] - 2021-11-18
4
6
 
5
7
  - Initial release
@@ -1,13 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Hws::Transactions::Models
4
- class Base < ActiveRecord::Base # :nodoc:
5
- self.abstract_class = true
3
+ class Hws::Transactions::Models::Base < ActiveRecord::Base # :nodoc:
4
+ self.abstract_class = true
6
5
 
7
- before_create :set_uuid
6
+ before_create :set_uuid
8
7
 
9
- def set_uuid
10
- self.id = LSUUID.generate if self.id.blank?
11
- end
8
+ def set_uuid
9
+ self.id = LSUUID.generate if self.id.blank?
12
10
  end
13
11
  end
@@ -81,11 +81,11 @@ module Hws::Transactions::Models
81
81
  tags['immutable_tags'] = {} unless tags.key? 'immutable_tags'
82
82
 
83
83
  unless tags['mutable_tags'].keys.all? { |key| self.mutable_tags.include?(key) }
84
- raise 'Invalid mutable tags present in add_entry request.'
84
+ raise "Invalid mutable tags present in add_entry request. Given keys: #{tags['mutable_tags'].keys} | Allowed keys: #{self.mutable_tags}"
85
85
  end
86
86
 
87
87
  unless tags['immutable_tags'].keys.all? { |key| self.immutable_tags.include?(key) }
88
- raise 'Invalid immutable_tags tags present in add_entry request.'
88
+ raise "Invalid immutable_tags tags present in add_entry request. Given keys: #{tags['immutable_tags'].keys} | Allowed keys: #{self.immutable_tags}"
89
89
  end
90
90
 
91
91
  tags
@@ -47,10 +47,16 @@ module Hws # :nodoc:
47
47
  # 'last_entry': '',
48
48
  # 'page_size': 10
49
49
  # }
50
- def self.list_entries(transaction_group_id, filters, page_context)
50
+ def self.list_entries(transaction_group_id, filters = {}, page_context = {})
51
51
  self.get_group(transaction_group_id).try(:list_entries, filters.with_indifferent_access, page_context.with_indifferent_access)
52
52
  end
53
53
 
54
+ def self.get_entry(entry_id)
55
+ entry = ::Hws::Transactions::Models::TransactionEntry.find_by(id: entry_id)
56
+ { id: entry.id, transaction_group_id: entry.transaction_group_id, value: entry.value, txn_time: entry.txn_time,
57
+ tags: { immutable_tags: entry.immutable_tags, mutable_tags: entry.mutable_tags } }
58
+ end
59
+
54
60
  module Models # :nodoc:
55
61
  end
56
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hws-transactions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hypto Engineering Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-25 00:00:00.000000000 Z
11
+ date: 2021-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lsuuid