sibit 0.25.1 → 0.26.0

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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +18 -28
  3. data/Gemfile.lock +187 -0
  4. data/LICENSE.txt +1 -1
  5. data/LICENSES/MIT.txt +21 -0
  6. data/README.md +82 -60
  7. data/REUSE.toml +35 -0
  8. data/Rakefile +3 -29
  9. data/bin/sibit +7 -23
  10. data/cucumber.yml +3 -0
  11. data/features/cli.feature +2 -0
  12. data/features/gem_package.feature +4 -1
  13. data/features/step_definitions/steps.rb +2 -19
  14. data/features/support/env.rb +2 -19
  15. data/lib/sibit/bestof.rb +5 -22
  16. data/lib/sibit/bitcoin/base58.rb +50 -0
  17. data/lib/sibit/bitcoin/key.rb +87 -0
  18. data/lib/sibit/bitcoin/script.rb +58 -0
  19. data/lib/sibit/bitcoin/tx.rb +212 -0
  20. data/lib/sibit/bitcoin/txbuilder.rb +120 -0
  21. data/lib/sibit/bitcoinchain.rb +5 -22
  22. data/lib/sibit/blockchain.rb +5 -22
  23. data/lib/sibit/blockchair.rb +5 -22
  24. data/lib/sibit/btc.rb +6 -23
  25. data/lib/sibit/cex.rb +5 -22
  26. data/lib/sibit/cryptoapis.rb +5 -22
  27. data/lib/sibit/earn.rb +5 -21
  28. data/lib/sibit/error.rb +3 -20
  29. data/lib/sibit/fake.rb +3 -20
  30. data/lib/sibit/firstof.rb +5 -22
  31. data/lib/sibit/http.rb +3 -20
  32. data/lib/sibit/json.rb +6 -23
  33. data/lib/sibit/version.rb +4 -21
  34. data/lib/sibit.rb +31 -40
  35. data/logo.svg +1 -1
  36. data/sibit.gemspec +16 -32
  37. metadata +26 -47
  38. data/.0pdd.yml +0 -9
  39. data/.gitattributes +0 -7
  40. data/.github/workflows/codecov.yml +0 -21
  41. data/.github/workflows/pdd.yml +0 -15
  42. data/.github/workflows/rake.yml +0 -24
  43. data/.github/workflows/xcop.yml +0 -17
  44. data/.gitignore +0 -8
  45. data/.pdd +0 -7
  46. data/.rubocop.yml +0 -38
  47. data/.rultor.yml +0 -21
  48. data/.simplecov +0 -40
  49. data/lib/sibit/log.rb +0 -49
  50. data/renovate.json +0 -6
  51. data/test/test__helper.rb +0 -29
  52. data/test/test_bestof.rb +0 -62
  53. data/test/test_bitcoinchain.rb +0 -73
  54. data/test/test_blockchain.rb +0 -58
  55. data/test/test_blockchair.rb +0 -43
  56. data/test/test_btc.rb +0 -117
  57. data/test/test_cex.rb +0 -43
  58. data/test/test_cryptoapis.rb +0 -51
  59. data/test/test_fake.rb +0 -55
  60. data/test/test_firstof.rb +0 -62
  61. data/test/test_json.rb +0 -40
  62. data/test/test_live.rb +0 -138
  63. data/test/test_sibit.rb +0 -209
@@ -1,28 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
- require 'bitcoin'
24
6
  require 'iri'
25
7
  require 'json'
8
+ require 'loog'
26
9
  require 'uri'
27
10
  require_relative 'error'
28
11
  require_relative 'http'
@@ -35,13 +18,13 @@ require_relative 'version'
35
18
  # https://www.blockchain.com/api/blockchain_api
36
19
  #
37
20
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
38
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
21
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
39
22
  # License:: MIT
40
23
  class Sibit
41
24
  # Blockchain.info API.
42
25
  class Blockchain
43
26
  # Constructor.
44
- def initialize(log: Sibit::Log.new, http: Sibit::Http.new, dry: false)
27
+ def initialize(log: Loog::NULL, http: Sibit::Http.new, dry: false)
45
28
  @http = http
46
29
  @log = log
47
30
  @dry = dry
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'cgi'
24
7
  require 'iri'
@@ -26,20 +9,20 @@ require 'json'
26
9
  require 'uri'
27
10
  require_relative 'error'
28
11
  require_relative 'http'
12
+ require 'loog'
29
13
  require_relative 'json'
30
- require_relative 'log'
31
14
  require_relative 'version'
32
15
 
33
16
  # Blockchair.com API.
34
17
  #
35
18
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
36
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
19
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
37
20
  # License:: MIT
38
21
  class Sibit
39
22
  # Btc.com API.
40
23
  class Blockchair
41
24
  # Constructor.
42
- def initialize(key: nil, log: Sibit::Log.new, http: Sibit::Http.new, dry: false)
25
+ def initialize(key: nil, log: Loog::NULL, http: Sibit::Http.new, dry: false)
43
26
  @key = key
44
27
  @http = http
45
28
  @log = log
data/lib/sibit/btc.rb CHANGED
@@ -1,32 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'iri'
24
7
  require 'json'
25
8
  require 'uri'
26
9
  require_relative 'error'
27
10
  require_relative 'http'
11
+ require 'loog'
28
12
  require_relative 'json'
29
- require_relative 'log'
30
13
  require_relative 'version'
31
14
 
32
15
  # Btc.com API.
@@ -34,13 +17,13 @@ require_relative 'version'
34
17
  # Here: https://btc.com/api-doc
35
18
  #
36
19
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
37
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
20
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
38
21
  # License:: MIT
39
22
  class Sibit
40
23
  # Btc.com API.
41
24
  class Btc
42
25
  # Constructor.
43
- def initialize(log: Sibit::Log.new, http: Sibit::Http.new, dry: false)
26
+ def initialize(log: Loog::NULL, http: Sibit::Http.new, dry: false)
44
27
  @http = http
45
28
  @log = log
46
29
  @dry = dry
@@ -69,7 +52,7 @@ class Sibit
69
52
  @log.info("The balance of #{address} is probably zero (not found)")
70
53
  return 0
71
54
  end
72
- balance = txns.map { |tx| tx['value'] }.inject(&:+) || 0
55
+ balance = txns.sum { |tx| tx['value'] } || 0
73
56
  @log.info("The balance of #{address} is #{balance}, total txns: #{txns.count}")
74
57
  balance
75
58
  end
data/lib/sibit/cex.rb CHANGED
@@ -1,42 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'uri'
24
7
  require 'json'
8
+ require 'loog'
25
9
  require_relative 'error'
26
- require_relative 'log'
27
10
  require_relative 'http'
28
11
  require_relative 'json'
29
12
 
30
13
  # Cex.io API.
31
14
  #
32
15
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
33
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
16
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
34
17
  # License:: MIT
35
18
  class Sibit
36
19
  # Btc.com API.
37
20
  class Cex
38
21
  # Constructor.
39
- def initialize(log: Sibit::Log.new, http: Sibit::Http.new, dry: false)
22
+ def initialize(log: Loog::NULL, http: Sibit::Http.new, dry: false)
40
23
  @http = http
41
24
  @log = log
42
25
  @dry = dry
@@ -1,44 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'iri'
24
7
  require 'json'
25
8
  require 'uri'
26
9
  require_relative 'error'
27
10
  require_relative 'http'
11
+ require 'loog'
28
12
  require_relative 'json'
29
- require_relative 'log'
30
13
  require_relative 'version'
31
14
 
32
15
  # Cryptoapis.io API.
33
16
  #
34
17
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
35
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
18
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
36
19
  # License:: MIT
37
20
  class Sibit
38
21
  # Btc.com API.
39
22
  class Cryptoapis
40
23
  # Constructor.
41
- def initialize(key, log: Sibit::Log.new, http: Sibit::Http.new, dry: false)
24
+ def initialize(key, log: Loog::NULL, http: Sibit::Http.new, dry: false)
42
25
  @key = key
43
26
  @http = http
44
27
  @log = log
data/lib/sibit/earn.rb CHANGED
@@ -1,27 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'iri'
24
7
  require 'json'
8
+ require 'loog'
25
9
  require 'uri'
26
10
  require_relative 'error'
27
11
  require_relative 'http'
@@ -31,13 +15,13 @@ require_relative 'version'
31
15
  # Earn.com API.
32
16
  #
33
17
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
34
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
18
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
35
19
  # License:: MIT
36
20
  class Sibit
37
21
  # Blockchain.info API.
38
22
  class Earn
39
23
  # Constructor.
40
- def initialize(log: Sibit::Log.new, http: Sibit::Http.new, dry: false)
24
+ def initialize(log: Loog::NULL, http: Sibit::Http.new, dry: false)
41
25
  @http = http
42
26
  @log = log
43
27
  @dry = dry
data/lib/sibit/error.rb CHANGED
@@ -1,29 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  # The error.
24
7
  #
25
8
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
26
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
9
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
27
10
  # License:: MIT
28
11
  class Sibit
29
12
  # The error.
data/lib/sibit/fake.rb CHANGED
@@ -1,31 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require_relative 'version'
24
7
 
25
8
  # Fake API.
26
9
  #
27
10
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
28
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
11
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
29
12
  # License:: MIT
30
13
  class Sibit
31
14
  # Fake API
data/lib/sibit/firstof.rb CHANGED
@@ -1,39 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'backtrace'
7
+ require 'loog'
24
8
  require_relative 'error'
25
- require_relative 'log'
26
9
 
27
10
  # API first of.
28
11
  #
29
12
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
13
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
31
14
  # License:: MIT
32
15
  class Sibit
33
16
  # First of API.
34
17
  class FirstOf
35
18
  # Constructor.
36
- def initialize(list, log: Sibit::Log.new, verbose: false)
19
+ def initialize(list, log: Loog::NULL, verbose: false)
37
20
  @list = list
38
21
  @log = log
39
22
  @verbose = verbose
data/lib/sibit/http.rb CHANGED
@@ -1,31 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'net/http'
24
7
 
25
8
  # HTTP interface.
26
9
  #
27
10
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
28
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
11
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
29
12
  # License:: MIT
30
13
  class Sibit
31
14
  # This HTTP client will be used by default.
data/lib/sibit/json.rb CHANGED
@@ -1,32 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'json'
24
7
  require 'uri'
25
8
  require 'cgi'
26
9
  require_relative 'version'
27
10
  require_relative 'error'
11
+ require 'loog'
28
12
  require_relative 'http'
29
- require_relative 'log'
30
13
 
31
14
  # Json SDK.
32
15
  #
@@ -34,13 +17,13 @@ require_relative 'log'
34
17
  # https://www.blockchain.com/api/blockchain_api
35
18
  #
36
19
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
37
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
20
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
38
21
  # License:: MIT
39
22
  class Sibit
40
23
  # JSON processing.
41
24
  class Json
42
25
  # Constructor.
43
- def initialize(log: Sibit::Log.new, http: Sibit::Http.new)
26
+ def initialize(log: Loog::NULL, http: Sibit::Http.new)
44
27
  @http = http
45
28
  @log = log
46
29
  end
@@ -52,7 +35,7 @@ class Sibit
52
35
  start = Time.now
53
36
  uri = URI(address.to_s)
54
37
  res = @http.client(uri).get(
55
- "#{uri.path.empty? ? '/' : uri.path}#{uri.query ? "?#{uri.query}" : ''}",
38
+ "#{uri.path.empty? ? '/' : uri.path}#{"?#{uri.query}" if uri.query}",
56
39
  {
57
40
  'Accept' => 'application/json',
58
41
  'User-Agent' => user_agent,
data/lib/sibit/version.rb CHANGED
@@ -1,30 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the 'Software'), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in all
13
- # copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  # Sibit main class.
24
7
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
25
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
8
+ # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
26
9
  # License:: MIT
27
10
  class Sibit
28
11
  # Current version of the library.
29
- VERSION = '0.25.1'
12
+ VERSION = '0.26.0'
30
13
  end