ecm-blockchain-api 1.1.0 → 1.1.2

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: 3c29f674d6983fe3dcf4b95893a2303be793d7a5076376522f095be9fc49c11c
4
- data.tar.gz: cc8b4f888bc347214ad4594ab2326c4c26772f77d0181708d80a04b2dc3128eb
3
+ metadata.gz: 93a0df1e9fc9e65f7ec379b5fc911c74c26942fb78c419ae640238d12e686d28
4
+ data.tar.gz: dd2d7d7f65d3ad179844529dd5c5e74e1cf82ad47da82bb217f1316dbb8d8349
5
5
  SHA512:
6
- metadata.gz: c944def2149adf904e7e44b33772d42b12253124f8c3578d841be171ba0a8faf5004805fd95f105623ff2bcb9acc0ed70f8d378a181b5764cfe57a58251d99ab
7
- data.tar.gz: 8b2ede233cc6bdd1f0da48568fcf69808a8ebc820a449d43bb16601226586fe32eebcb609277a34126d2c6d22c67c087d41dcefe3b4ed20ff8492815618fd79f
6
+ metadata.gz: a1da828650924b734f9aaecbbaafac6d637f2f90fc96053eb1b1d831748ead745fe94cfa17fe9ba422bf11ee89f4ba3cf188523e638d88436ea96a625937f8e4
7
+ data.tar.gz: 0c37b022609dcbcf17ccaa4e95de7d5be3a42f0c4e693308c3efc3147777674cf6cc31e993aae52642b8b4d4d9ccaac9759ff3d3fac2a46ceb2949d78d3f1395
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ecm_blockchain_api (1.0.1)
4
+ ecm-blockchain-api (1.1.1)
5
5
  activemodel (~> 7.0, >= 7.0.4.3)
6
6
  httparty (~> 0.22.0)
7
7
 
@@ -112,7 +112,7 @@ PLATFORMS
112
112
  DEPENDENCIES
113
113
  activemodel (~> 7.0, >= 7.0.4.3)
114
114
  activesupport (~> 7.0, >= 7.0.4.3)
115
- ecm_blockchain_api!
115
+ ecm-blockchain-api!
116
116
  factory_bot
117
117
  faker
118
118
  pry
data/bin/console CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "bundler/setup"
5
- require "ecm_blockchain_api"
5
+ require "ecm-blockchain-api"
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,7 +10,7 @@ require "ecm_blockchain_api"
10
10
  # (If you use this, don't forget to add pry to your Gemfile!)
11
11
  # require "pry"
12
12
  # Pry.start
13
- ECMBlockchain.base_url = "http://localhost:3000/v1"
13
+ ECMBlockchain.base_url = "http://localhost:3002/v1"
14
14
  # ECMBlockchain.access_token = ""
15
15
  ECMBlockchain.access_token = "W4nd3rl4nds!"
16
16
 
@@ -21,6 +21,11 @@ module ECMBlockchain
21
21
  OpenStruct.new(success: true, details: "Certificate successfully revoked")
22
22
  end
23
23
 
24
+ def crypto_material(identity)
25
+ response = request( :get, "/#{identity}#{MEMBERS_URL}/crypto")
26
+ OpenStruct.new(response)
27
+ end
28
+
24
29
  private
25
30
 
26
31
  def member(params)
@@ -1,4 +1,5 @@
1
1
  require 'active_model'
2
+ require 'json'
2
3
 
3
4
  module ECMBlockchain
4
5
  class AssetModel
@@ -13,8 +14,16 @@ module ECMBlockchain
13
14
  class << self
14
15
  def verify(data={})
15
16
  asset = self.new(data)
16
- raise ECMBlockchain::UnprocessableEntityError.new(
17
- asset.errors.full_messages.first, 422
17
+ raise ECMBlockchain::Error.raise_error(
18
+ OpenStruct.new(
19
+ code: 422,
20
+ body: {
21
+ error: {
22
+ message: asset.errors.full_messages.first,
23
+ details: ''
24
+ }
25
+ }.to_json
26
+ )
18
27
  ) unless asset.valid?
19
28
  asset
20
29
  end
@@ -44,7 +53,10 @@ module ECMBlockchain
44
53
 
45
54
  def data_file_or_content?
46
55
  unless file.valid? || content.valid?
47
- errors.add(:base, "Please supply either a file object or content object")
56
+ errors.add(:base,
57
+ "file or content error: #{file.errors.full_messages.first || content.errors.full_messages.first ||
58
+ "Please supply either a file object or content object"}"
59
+ )
48
60
  end
49
61
  end
50
62
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ECMBlockchain
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm-blockchain-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wardy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-29 00:00:00.000000000 Z
11
+ date: 2024-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty