vkdonate 1.0.2 → 1.1.0

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: aef0225bab369599e43474b1164d5d0560286e217e36223b28001c497e3a1be6
4
- data.tar.gz: ed0165051595e9d2b4ef0fd40717410a5bbfc8eb16c864797d55713805596cbc
3
+ metadata.gz: a8f1e20f5c7f0e039827614913ccf8873921cf94cb382563d8bfc993670e0abb
4
+ data.tar.gz: cd466099a4d030217258d97a70d860733ebd81fee2fa91f2342dab04b7074ba9
5
5
  SHA512:
6
- metadata.gz: 7fa8c5c596bf40421b0c4a198cdd66c842bc99b4280c925e9d5b485e8264df1104adea0d513151ef7b0d00a435893e56f808b48b67f0f9bcc4f591db4571991a
7
- data.tar.gz: f369642650d2bf76fc2ab76add329412e6fbfcc2afd3767c18dd9cccb775ce57db7d5daf94752a1b999ad09d74c84f5fd6d247a36723bee272c8cdb6a9d3d915
6
+ metadata.gz: 0d1b22d1284a68423122b8e05462f8467ef07741988e5b74b72d91ed2630449453e495ab9e6f5cf65847f13e0f33c223b313a7e34a0f2a2fc538902104bfaf48
7
+ data.tar.gz: 2c1b3f63ab414c0efe8f95e57f533cca7f4a6419a3513683779a5f28b7c4c0da9b7bb8c6b8020e63f53ce4ff1c64b7623c82e0ecc55b72e29c9d4aad13c92069
@@ -0,0 +1 @@
1
+ API_KEY=0123456789abcdefg
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Set up Ruby
24
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
25
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
26
+ # uses: ruby/setup-ruby@v1
27
+ uses: ruby/setup-ruby@v1.52.0
28
+ with:
29
+ ruby-version: 2.7.2
30
+ - name: Install dependencies
31
+ run: bundle install
32
+ - name: Run rubocop
33
+ run: bundle exec rake rubocop
34
+ - name: Run yarddoc
35
+ run: bundle exec rake yard
data/.gitignore CHANGED
@@ -1,8 +1,11 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/cassetes/
9
+ /tmp/
10
+ .env
11
+ .byebug_history
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1,60 @@
1
+ # The behavior of RuboCop can be controlled via the .rubocop.yml
2
+ # configuration file. It makes it possible to enable/disable
3
+ # certain cops (checks) and to alter their behavior if they accept
4
+ # any parameters. The file can be placed either in your home
5
+ # directory or in some project directory.
6
+ #
7
+ # RuboCop will start looking for the configuration file in the directory
8
+ # where the inspected file is and continue its way up to the root directory.
9
+ #
10
+ # See https://docs.rubocop.org/rubocop/configuration
11
+
12
+ AllCops:
13
+ TargetRubyVersion: 2.7
14
+ EnabledByDefault: true
15
+
16
+ Layout/FirstMethodParameterLineBreak:
17
+ Enabled: false
18
+ Layout/FirstMethodArgumentLineBreak:
19
+ Enabled: false
20
+ Layout/MultilineMethodArgumentLineBreaks:
21
+ Enabled: false
22
+ Layout/EndOfLine:
23
+ Enabled: false
24
+ Layout/EndAlignment:
25
+ EnforcedStyleAlignWith: variable
26
+ Layout/FirstHashElementIndentation:
27
+ Enabled: false
28
+ Layout/MultilineAssignmentLayout:
29
+ EnforcedStyle: same_line
30
+ Layout/CaseIndentation:
31
+ EnforcedStyle: end
32
+ Lint/ConstantResolution:
33
+ Enabled: false
34
+ Metrics/ParameterLists:
35
+ Enabled: false
36
+ Metrics/BlockLength:
37
+ Exclude:
38
+ - 'spec/**/*_spec.rb'
39
+ Style/MethodCallWithArgsParentheses:
40
+ Enabled: false
41
+ Style/Copyright:
42
+ Enabled: false
43
+ Style/ClassVars:
44
+ Enabled: false
45
+ Style/MissingElse:
46
+ Enabled: false
47
+ Style/StringHashKeys:
48
+ Enabled: false
49
+ Style/ImplicitRuntimeError:
50
+ Enabled: false
51
+ Style/NumericLiterals:
52
+ Enabled: false
53
+ Style/DisableCopsWithinSourceCodeDirective:
54
+ Enabled: false
55
+ Style/DoubleNegation:
56
+ Enabled: false
57
+ Style/DateTime:
58
+ Enabled: false
59
+ Layout/MultilineHashKeyLineBreaks:
60
+ Enabled: false
data/Gemfile CHANGED
@@ -1,6 +1,38 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in vkdonate.gemspec
4
6
  gemspec
5
-
6
- gem "json", "~> 2.2"
7
+
8
+ group :test, :development do
9
+ # Debugging console
10
+ gem 'pry'
11
+
12
+ # Another debugging console
13
+ gem 'byebug'
14
+
15
+ # The thing, forcing you to write good code
16
+ gem 'rubocop', require: false
17
+
18
+ # Rake tasks
19
+ gem 'rake', require: false
20
+
21
+ # Testing
22
+ gem 'rspec', require: false
23
+
24
+ # Docs
25
+ gem 'yard', require: false
26
+
27
+ # .env support
28
+ gem 'dotenv'
29
+
30
+ # Save web requests for fast and reliable testing
31
+ gem 'vcr'
32
+
33
+ # Stub web requests
34
+ gem 'webmock'
35
+
36
+ # Test coverage
37
+ gem 'simplecov', require: false, group: :test
38
+ end
@@ -1,24 +1,88 @@
1
- PATH
2
- remote: .
3
- specs:
4
- vkdonate (1.0.1)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- json (2.2.0)
10
- minitest (5.11.3)
11
- rake (12.3.3)
12
-
13
- PLATFORMS
14
- x64-mingw32
15
-
16
- DEPENDENCIES
17
- bundler (~> 2.0)
18
- json (~> 2.2)
19
- minitest (~> 5.0)
20
- rake (~> 12.0)
21
- vkdonate!
22
-
23
- BUNDLED WITH
24
- 2.0.2
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ vkdonate (1.0.2)
5
+ json (~> 2.3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.7.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ ast (2.4.1)
13
+ byebug (11.1.3)
14
+ coderay (1.1.3)
15
+ crack (0.4.4)
16
+ diff-lcs (1.4.4)
17
+ docile (1.3.2)
18
+ dotenv (2.7.6)
19
+ hashdiff (1.0.1)
20
+ json (2.3.1)
21
+ method_source (1.0.0)
22
+ parallel (1.20.1)
23
+ parser (2.7.2.0)
24
+ ast (~> 2.4.1)
25
+ pry (0.13.1)
26
+ coderay (~> 1.1)
27
+ method_source (~> 1.0)
28
+ public_suffix (4.0.6)
29
+ rainbow (3.0.0)
30
+ rake (13.0.1)
31
+ regexp_parser (2.0.0)
32
+ rexml (3.2.4)
33
+ rspec (3.10.0)
34
+ rspec-core (~> 3.10.0)
35
+ rspec-expectations (~> 3.10.0)
36
+ rspec-mocks (~> 3.10.0)
37
+ rspec-core (3.10.0)
38
+ rspec-support (~> 3.10.0)
39
+ rspec-expectations (3.10.0)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.10.0)
42
+ rspec-mocks (3.10.0)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.10.0)
45
+ rspec-support (3.10.0)
46
+ rubocop (1.4.2)
47
+ parallel (~> 1.10)
48
+ parser (>= 2.7.1.5)
49
+ rainbow (>= 2.2.2, < 4.0)
50
+ regexp_parser (>= 1.8)
51
+ rexml
52
+ rubocop-ast (>= 1.1.1)
53
+ ruby-progressbar (~> 1.7)
54
+ unicode-display_width (>= 1.4.0, < 2.0)
55
+ rubocop-ast (1.2.0)
56
+ parser (>= 2.7.1.5)
57
+ ruby-progressbar (1.10.1)
58
+ simplecov (0.19.1)
59
+ docile (~> 1.1)
60
+ simplecov-html (~> 0.11)
61
+ simplecov-html (0.12.3)
62
+ unicode-display_width (1.7.0)
63
+ vcr (6.0.0)
64
+ webmock (3.10.0)
65
+ addressable (>= 2.3.6)
66
+ crack (>= 0.3.2)
67
+ hashdiff (>= 0.4.0, < 2.0.0)
68
+ yard (0.9.25)
69
+
70
+ PLATFORMS
71
+ ruby
72
+ x64-mingw32
73
+
74
+ DEPENDENCIES
75
+ byebug
76
+ dotenv
77
+ pry
78
+ rake
79
+ rspec
80
+ rubocop
81
+ simplecov
82
+ vcr
83
+ vkdonate!
84
+ webmock
85
+ yard
86
+
87
+ BUNDLED WITH
88
+ 2.1.4
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vkdonate
2
2
 
3
- This is small non-official gem which provides interface to interact with vkdonate.ru API.
3
+ This is small non-official gem which provides interface to interact with [vkdonate.ru API](https://vkdonate.ru/help#api).
4
4
 
5
5
  ## Installation
6
6
 
data/Rakefile CHANGED
@@ -1,10 +1,18 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ # frozen_string_literal: true
3
2
 
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
6
+ require 'yard'
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ YARD::Rake::YardocTask.new do |t|
13
+ t.files = ['lib/**/*.rb']
14
+ t.options = ['--any', '--extra', '--opts']
15
+ t.stats_options = ['--list-undoc']
8
16
  end
9
17
 
10
- task :default => :test
18
+ task default: %i[rubocop spec yard]
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "vkdonate"
4
+ require 'bundler/setup'
5
+ require 'vkdonate'
6
+ require 'pry'
7
+ require 'dotenv'
8
+ Dotenv.load
5
9
 
6
- require "irb"
7
- IRB.start(__FILE__)
10
+ Pry.start
@@ -1,131 +1,87 @@
1
- require "vkdonate/version"
2
- require "vkdonate/donate"
1
+ # frozen_string_literal: true
3
2
 
4
- require "net/http"
5
- require "json"
6
- require "date"
3
+ require 'net/http'
4
+ require 'json'
5
+ require 'date'
7
6
 
8
- ##
9
- # Main module.
7
+ require 'vkdonate/client'
8
+ require 'vkdonate/donate'
9
+
10
+ # Main module
10
11
  module Vkdonate
12
+ # Gem version
13
+ VERSION = '1.1.0'
14
+ public_constant :VERSION
11
15
 
12
- ##
13
- # URI for requests.
14
- REQUEST_URI = URI("https://api.vkdonate.ru")
16
+ # URI for requests
17
+ REQUEST_URI = URI('https://api.vkdonate.ru')
18
+ private_constant :REQUEST_URI
15
19
 
16
- ##
17
- # Array of available actions.
18
- ACTIONS = [:donates]
20
+ # Array of available actions
21
+ ACTIONS = %i[donates].freeze
22
+ private_constant :ACTIONS
19
23
 
20
- ##
21
- # Array of available sort-by.
22
- SORT = [:date, :sum]
24
+ # Array of available sort-by
25
+ SORT = %i[date sum].freeze
26
+ private_constant :SORT
23
27
 
24
- ##
25
- # Array of available order-by.
26
- ORDER = [:asc, :desc]
28
+ # Array of available order-by
29
+ ORDER = %i[asc desc].freeze
30
+ private_constant :ORDER
27
31
 
28
- ##
29
- # Time offset of API server.
30
- TIME_OFFSET = "UTC+3"
32
+ # Time offset of API server
33
+ TIME_OFFSET = 'UTC+3'
34
+ private_constant :TIME_OFFSET
31
35
 
32
- ##
33
36
  # Requests timeout in seconds
34
37
  REQUEST_TIMEOUT = 10
38
+ private_constant :REQUEST_TIMEOUT
35
39
 
36
- ##
37
40
  # @!macro [new] request_option
38
- # @option options [Integer] count (10) amount of donates (up to 50).
39
- # @option options [Integer] offset (0) donates offset.
40
- # @option options [Symbol] sort (:date) sort by.
41
- # @option options [Symbol] order (:desc) order by.
41
+ # @param count [Integer] amount of donates (up to 50)
42
+ # @param offset [Integer] donates offset
43
+ # @param sort [Symbol] sort by
44
+ # @param order [Symbol] order by
42
45
  # @see Vkdonate::SORT
43
46
  # @see Vkdonate::ORDER
44
- #
45
- # @!macro [new] request_return
46
- # @return [Array]
47
- #
48
- # @!macro [new] request
49
- # Simple POST request to API.
50
- # @param action [Symbol]
51
- # @param options [Hash]
52
- # @!macro request_option
53
- # @see Vkdonate::ACTIONS
54
- # @!macro request_return
55
- #
56
- # @!macro [new] donates
57
- # POST request for +donates+ action.
58
- # @param options [Hash]
59
- # @!macro request_option
60
- # @see Vkdonate::ACTIONS
61
- # @!macro request_return
62
-
63
- ##
64
- # @param api_key [String]
65
- # @!macro request
66
- def self.request(api_key, action, options = {})
67
- raise "Unknown action" unless ACTIONS.include? action
68
-
69
- count = options[:count] || 10
70
- offset = options[:offset] || 0
71
- sort = options[:sort] || :date
72
- order = options[:order] || :desc
73
-
74
- raise "Count is out of range" unless count >= 1 && count <= 50
75
- raise "Offset is out of range" unless offset >= 0
76
- raise "Unknown sorting" unless SORT.include? sort
77
- raise "Unknown ordering" unless ORDER.include? order
78
-
79
- res = Net::HTTP.post_form(REQUEST_URI,
80
- key: api_key.to_s,
81
- action: action.to_s,
82
- count: count.to_i,
83
- offset: offset.to_i,
84
- sort: sort.to_s,
85
- order: order.to_s
86
- )
87
-
88
- json = JSON.parse res.body
89
-
90
- if json["success"]
91
- json["donates"].map { |e| Donate.from_json(e) }
92
- else
93
- raise json["text"]
94
- end
95
- end
96
47
 
97
- ##
98
- # @param api_key [String]
99
- # @!macro donates
100
- def self.donates(api_key, options = {})
101
- request(api_key, :donates, options)
102
- end
48
+ class << self
49
+ # Simple POST request to API
50
+ # @param api_key [String]
51
+ # @param action [Symbol]
52
+ # @!macro request_option
53
+ # @see Vkdonate::ACTIONS
54
+ # @return [Array]
55
+ def request(api_key, action, count: 10, offset: 0, sort: :date, order: :desc)
56
+ validate_request_options(action, count, offset, sort, order)
103
57
 
104
- ##
105
- # Client which saves API key.
106
- class Client
58
+ res = Net::HTTP.post_form(REQUEST_URI, key: api_key, action: action.to_s, count: count,
59
+ offset: offset, sort: sort.to_s, order: order.to_s)
107
60
 
108
- ##
109
- # New client to work with API.
110
- #
111
- # @param api_key [String]
112
- def initialize(api_key)
113
- @api_key = api_key.to_s
114
- raise "API key can not be empty" if @api_key.empty?
115
- end
61
+ json = JSON.parse res.body
62
+
63
+ raise json['text'] unless json['success']
116
64
 
117
- ##
118
- # @!macro request
119
- def request(action, options = {})
120
- Vkdonate.request(@api_key, action, options)
65
+ json['donates'].map { |e| Donate.from_json(e) }
121
66
  end
122
67
 
123
- ##
124
- # @!macro donates
125
- def donates(options = {})
126
- Vkdonate.donates(@api_key, options)
68
+ # POST request for +donates+ action
69
+ # @param api_key [String]
70
+ # @!macro request_option
71
+ # @see Vkdonate.request
72
+ # @return [Array]
73
+ def donates(api_key, **options)
74
+ request(api_key, :donates, **options)
127
75
  end
128
76
 
129
- end
77
+ private
130
78
 
79
+ def validate_request_options(action, count, offset, sort, order)
80
+ raise 'Unknown action' unless ACTIONS.include? action
81
+ raise 'Count is out of range' unless count >= 1 && count <= 50
82
+ raise 'Offset is out of range' unless offset >= 0
83
+ raise 'Unknown sorting' unless SORT.include? sort
84
+ raise 'Unknown ordering' unless ORDER.include? order
85
+ end
86
+ end
131
87
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vkdonate
4
+ # Client which saves API key
5
+ class Client
6
+ # New client to work with API
7
+ # @param api_key [String]
8
+ def initialize(api_key)
9
+ @api_key = api_key.to_s
10
+ raise 'API key can not be empty' if @api_key.empty?
11
+ end
12
+
13
+ # @see VkDonate.request
14
+ def request(action, **options)
15
+ Vkdonate.request(@api_key, action, **options)
16
+ end
17
+
18
+ # @see VkDonate.donates
19
+ def donates(**options)
20
+ Vkdonate.donates(@api_key, **options)
21
+ end
22
+ end
23
+ end
@@ -1,94 +1,69 @@
1
- module Vkdonate
2
-
3
- ##
4
- # Single donation
5
- class Donate
6
-
7
- ##
8
- # @return [Integer] Unique payment ID.
9
- attr_reader :id
10
-
11
- ##
12
- # @return [Integer] Donator VK ID.
13
- attr_reader :uid
14
-
15
- ##
16
- # @return [DateTime] Date and time of donation.
17
- attr_reader :date
18
-
19
- ##
20
- # @return [Integer] Size of donation.
21
- attr_reader :sum
22
-
23
- ##
24
- # @return [String, nil] User message or +nil+ if empty.
25
- attr_reader :msg
26
- alias_method :message, :msg
27
-
28
- ##
29
- # @return [Boolean] Whether donation is anonymous.
30
- attr_reader :anon
31
- alias_method :anon?, :anon
32
-
33
- ##
34
- # @return [Boolean] Whether donate is visible in group.
35
- attr_reader :visible
36
- alias_method :visible?, :visible
37
-
38
- ##
39
- # @return [String] Human readable information.
40
- def to_s
41
- "Donation ##{id} by @#{uid} for #{sum}RUR (at #{date})"
42
- end
43
-
44
- ##
45
- # Save data about donation.
46
- #
47
- # @param options [Hash]
48
- #
49
- # @option options [Integer] id
50
- # @option options [Integer] uid
51
- # @option options [DateTime] date
52
- # @option options [Integer] sum
53
- # @option options [String, nil] msg
54
- # @option options [Boolean] anon
55
- # @option options [Boolean] visible
56
- def initialize(options)
57
- @id = options[:id].to_i
58
-
59
- @uid = options[:uid].to_i
60
-
61
- @date = options[:date]
62
- raise unless DateTime === @date
63
-
64
- @sum = options[:sum].to_i
65
-
66
- @msg = options[:msg].to_s
67
- @msg = nil if @msg.empty?
68
-
69
- @anon = !!options[:anon]
70
-
71
- @visible = !!options[:visible]
72
- end
73
-
74
- ##
75
- # Parse from JSON hash.
76
- #
77
- # @param hash [Hash] parsed JSON hash.
78
- #
79
- # @return [Donate]
80
- def self.from_json(hash)
81
- self.new(
82
- id: hash["id"].to_i,
83
- uid: hash["uid"].to_i,
84
- date: DateTime.parse(hash["date"] + " #{TIME_OFFSET}"),
85
- sum: hash["sum"].to_i,
86
- msg: hash["msg"].empty? ? nil : hash["msg"],
87
- anon: !hash["anon"].to_i.zero?,
88
- visible: !hash["visible"].to_i.zero?
89
- )
90
- end
91
-
92
- end
93
-
94
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Vkdonate
4
+ # Single donation
5
+ class Donate
6
+ # @return [Integer] Unique payment ID
7
+ attr_reader :id
8
+
9
+ # @return [Integer] Donator VK ID
10
+ attr_reader :uid
11
+
12
+ # @return [DateTime] Date and time of donation
13
+ attr_reader :date
14
+
15
+ # @return [Integer] Size of donation
16
+ attr_reader :sum
17
+
18
+ # @return [String] User message or +nil+ if empty
19
+ attr_reader :msg
20
+ alias message msg
21
+
22
+ # @return [Boolean] Whether donation is anonymous
23
+ attr_reader :anon
24
+ alias anon? anon
25
+
26
+ # @return [Boolean] Whether donate is visible in group
27
+ attr_reader :visible
28
+ alias visible? visible
29
+
30
+ # Save data about donation.
31
+ # @param options [Hash]
32
+ # @option options [Integer] id
33
+ # @option options [Integer] uid
34
+ # @option options [DateTime] date
35
+ # @option options [Integer] sum
36
+ # @option options [String] msg
37
+ # @option options [Boolean] anon
38
+ # @option options [Boolean] visible
39
+ def initialize(id:, uid:, date:, sum:, msg:, anon:, visible:)
40
+ @id = id
41
+ @uid = uid
42
+ @date = date
43
+ @sum = sum
44
+ @msg = msg
45
+ @anon = anon
46
+ @visible = visible
47
+ end
48
+
49
+ # Parse from JSON hash.
50
+ # @param hash [Hash] parsed JSON hash.
51
+ # @return [Donate]
52
+ def self.from_json(hash)
53
+ new(
54
+ id: hash['id'],
55
+ uid: hash['uid'],
56
+ date: DateTime.parse(hash['date'] + " #{TIME_OFFSET}"),
57
+ sum: hash['sum'],
58
+ msg: hash['msg'].to_s,
59
+ anon: Integer(hash['anon'].to_s, 10) != 0,
60
+ visible: Integer(hash['visible'].to_s, 10) != 0
61
+ )
62
+ end
63
+
64
+ # @return [String] Human readable information
65
+ def to_s
66
+ "Donation ##{id} by @#{uid} for #{sum}RUR (at #{date})"
67
+ end
68
+ end
69
+ end
@@ -1,29 +1,31 @@
1
- lib = File.expand_path("lib", __dir__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "vkdonate/version"
5
+ require 'vkdonate'
4
6
 
5
7
  Gem::Specification.new do |spec|
6
- spec.name = "vkdonate"
8
+ spec.name = 'vkdonate'
7
9
  spec.version = Vkdonate::VERSION
8
- spec.authors = ["Fizvlad"]
9
- spec.email = ["fizvlad@mail.ru"]
10
+ spec.authors = ['Fizvlad']
11
+ spec.email = ['fizvlad@mail.ru']
12
+
13
+ spec.summary = 'This is small non-official gem which provides interface to interact with vkdonate.ru API'
14
+ spec.homepage = 'https://github.com/fizvlad/vkdonate-rb'
15
+ spec.license = 'MIT'
10
16
 
11
- spec.summary = "This is small non-official gem which provides interface to interact with vkdonate.ru API"
12
- spec.homepage = "https://github.com/fizvlad/vkdonate-rb"
13
- spec.license = "MIT"
17
+ spec.required_ruby_version = '>=2.7.1'
14
18
 
15
- spec.metadata["homepage_uri"] = spec.homepage
16
- spec.metadata["source_code_uri"] = "https://github.com/fizvlad/vkdonate-rb"
17
- spec.metadata["changelog_uri"] = "https://github.com/fizvlad/vkdonate-rb/releases"
19
+ spec.metadata['homepage_uri'] = spec.homepage
20
+ spec.metadata['source_code_uri'] = 'https://github.com/fizvlad/vkdonate-rb'
21
+ spec.metadata['changelog_uri'] = 'https://github.com/fizvlad/vkdonate-rb/releases'
18
22
 
19
23
  # Specify which files should be added to the gem when it is released.
20
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
26
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
27
  end
24
- spec.require_paths = ["lib"]
28
+ spec.require_paths = ['lib']
25
29
 
26
- spec.add_development_dependency "bundler", "~> 2.0"
27
- spec.add_development_dependency "rake", "~> 12.0"
28
- spec.add_development_dependency "minitest", "~> 5.0"
30
+ spec.add_runtime_dependency('json', '~> 2.3')
29
31
  end
metadata CHANGED
@@ -1,57 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vkdonate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fizvlad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-22 00:00:00.000000000 Z
11
+ date: 2020-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :development
19
+ version: '2.3'
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '12.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '12.0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '5.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '5.0'
26
+ version: '2.3'
55
27
  description:
56
28
  email:
57
29
  - fizvlad@mail.ru
@@ -59,8 +31,11 @@ executables: []
59
31
  extensions: []
60
32
  extra_rdoc_files: []
61
33
  files:
34
+ - ".env.example"
35
+ - ".github/workflows/ruby.yml"
62
36
  - ".gitignore"
63
- - ".travis.yml"
37
+ - ".rspec"
38
+ - ".rubocop.yml"
64
39
  - Gemfile
65
40
  - Gemfile.lock
66
41
  - LICENSE
@@ -68,8 +43,8 @@ files:
68
43
  - Rakefile
69
44
  - bin/console
70
45
  - lib/vkdonate.rb
46
+ - lib/vkdonate/client.rb
71
47
  - lib/vkdonate/donate.rb
72
- - lib/vkdonate/version.rb
73
48
  - vkdonate.gemspec
74
49
  homepage: https://github.com/fizvlad/vkdonate-rb
75
50
  licenses:
@@ -86,14 +61,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
61
  requirements:
87
62
  - - ">="
88
63
  - !ruby/object:Gem::Version
89
- version: '0'
64
+ version: 2.7.1
90
65
  required_rubygems_version: !ruby/object:Gem::Requirement
91
66
  requirements:
92
67
  - - ">="
93
68
  - !ruby/object:Gem::Version
94
69
  version: '0'
95
70
  requirements: []
96
- rubygems_version: 3.0.4
71
+ rubygems_version: 3.1.2
97
72
  signing_key:
98
73
  specification_version: 4
99
74
  summary: This is small non-official gem which provides interface to interact with
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.5.5
7
- before_install: gem install bundler -v 2.0.2
@@ -1,7 +0,0 @@
1
- module Vkdonate
2
-
3
- ##
4
- # Gem version.
5
- VERSION = "1.0.2"
6
-
7
- end