treezor_connect 0.17.0 → 0.18.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: 4e60667b52fc2193f89a8aac01256099849e9de5ea5bce8b58d9698937faf5a8
4
- data.tar.gz: 695a7240d1b43a59762196ba00d2d06aabf433e305e0fce2c2e70ab3a1a1133f
3
+ metadata.gz: db2ed2a4b70b4bd06ad796542a06ddc68e0e33a60162b9bccd6da971ab0eaff9
4
+ data.tar.gz: 262f23cf3c606aa310e6567ad1b06541e78d5b8d34f652cf78348def6cd23219
5
5
  SHA512:
6
- metadata.gz: 850f299e22d84072ab51f1bf3b3c8049147fdde9ede7a4c7514fbf76e953b24c93f09f486ef3e4c36d4979b326992889c0e70d0345b09d39ec9013d047e90ee9
7
- data.tar.gz: 22381003ca60d4669c6ccd0b7a2291e297e031c08bc950a4848e96eb3889aed5b4f87b83591abec1cc2dbd8bbdbe3cf03fdc5373b8c2b4d2372e988f417fe553
6
+ metadata.gz: c5b6c082ecd159415afc089885ba688602b13e18267bec2e2690d9bc71952e2c01804d0a644d4e5db92619d9202079d6e06d381321aa34e796faea0537558f98
7
+ data.tar.gz: 43f235d73a6fc116a6eb7ea64663aff9fbae187a80cf0d35307e3c52208dba5ec74e47efb9d1b2014c4548507ebf40dc7bb24fb2f0703e98aa866cc9516bb4a9
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TreezorConnect
4
- class ApiResource
4
+ class ApiResource < TreezorObject
5
5
  include TreezorConnect::ApiOperations::Request
6
6
 
7
7
  class << self
@@ -77,13 +77,13 @@ module TreezorConnect
77
77
  end
78
78
 
79
79
  def camelize(string, capitalize_first_letter: false)
80
- string
81
- .to_s
82
- .split('_')
83
- .map.with_index do |word, index|
84
- capitalize_first_letter || index.positive? ? word.capitalize : word
80
+ string.to_s.split('_').map.with_index do |word, index|
81
+ if word.match?(/\A[A-Z0-9]+\z/)
82
+ word
83
+ else
84
+ (capitalize_first_letter || index.positive? ? word.capitalize : word)
85
85
  end
86
- .join
86
+ end.join
87
87
  end
88
88
  end
89
89
  end
@@ -2,7 +2,9 @@
2
2
 
3
3
  module TreezorConnect
4
4
  class Card < ApiResource
5
- custom_action :put, :lock_unlock, :limits, first_letter_upcased: true
5
+ extend TreezorConnect::ApiOperations::Fetch
6
+ custom_action :put, :lock_unlock, :limits, :activate, first_letter_upcased: true
7
+ custom_action :post, :register_3DS, :create_virtual, first_letter_upcased: true
6
8
 
7
9
  OBJECT_NAME = 'card'
8
10
  OBJECT_KEY = 'cards'
@@ -6,6 +6,12 @@ module TreezorConnect
6
6
  @attributes = {}
7
7
  end
8
8
 
9
+ def to_hash
10
+ @attributes.transform_values do |value|
11
+ transform_value(value)
12
+ end
13
+ end
14
+
9
15
  def self.construct_from(data, opts = {})
10
16
  object_class = constantize_object_class(opts[:object_class])
11
17
  id = extract_id(data, object_class)
@@ -44,5 +50,15 @@ module TreezorConnect
44
50
  end
45
51
  end
46
52
  end
53
+
54
+ private
55
+
56
+ def transform_value(value)
57
+ if value.is_a?(Array)
58
+ value.map { |v| v.respond_to?(:to_hash) ? v.to_hash : v }
59
+ else
60
+ value.respond_to?(:to_hash) ? value.to_hash : value
61
+ end
62
+ end
47
63
  end
48
64
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: treezor_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - stefakins
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-03-12 00:00:00.000000000 Z
12
+ date: 2025-03-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A gem for making HTTP calls to Treezor Connect.
15
15
  email: stefan.atkinson69@gmail.com