transaction 0.1.2 → 0.1.3

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: ebe1a80b5e33a5409fde10ec7fc5820b79ec8102789326a9ac8bbf8b4b8a3ec1
4
- data.tar.gz: de004f228488f2b36c58c9028e427787bf5d03bff8d676226186729ec52a1aab
3
+ metadata.gz: 6018838c1f87e33db7de20a8351033ccd198f1514f98c8311f0655540eb72ae4
4
+ data.tar.gz: '0943937edf0341713288ae70a435a675201c737ac28e7f54626489a5451fb36f'
5
5
  SHA512:
6
- metadata.gz: d47be2f17326d9520819bed175dc04c7f9913eb45b2820442c144645d1322bd27013727ed5cb81f2692769d231736b907611db837216e5d1bf465afbc2db6dd2
7
- data.tar.gz: b87d4532392b8e955299a35fb43be6655a4de2d922ffeb80ae74feb43ab1d6c20743686797d2cd872f7ada9507f1a60006464a36f5fd8347867c12d7805e477b
6
+ metadata.gz: a091e13298ff3a7f100fabf0c3a280c37401b9ba4ff855c00ae7441acee4a5e2a1413261ed3f075f1a2a18852a52d7dc7be9dcb7a225bc7d7b1aeab79efdfae8
7
+ data.tar.gz: 639e410693019ea6aacfb4329aa2f7933b42aee8916081be9f87738f4b3d95f326f121704a3d52c1ab1142e1ccd5d9532a3442b823bf47ab787ab2018a0cd7ac
data/.codeclimate.yml ADDED
@@ -0,0 +1,22 @@
1
+ version: "2"
2
+ plugins:
3
+ rubocop:
4
+ enabled: true
5
+ channel: 'rubocop-0-60'
6
+ config:
7
+ file: ".rubocop.yml"
8
+ fixme:
9
+ enabled: true
10
+ bundler-audit:
11
+ enabled: true
12
+ reek:
13
+ enabled: true
14
+ checks:
15
+ IrresponsibleModule: # class has no descriptive comment
16
+ enabled: false
17
+ InstanceVariableAssumption: # assumes too much for instance variable (JSON api resources does)
18
+ enabled: false
19
+ flog:
20
+ enabled: true
21
+ config:
22
+ score_threshold: 20.0
data/.rubocop.yml ADDED
@@ -0,0 +1 @@
1
+ inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,39 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2019-07-18 12:09:48 +0530 using RuboCop version 0.61.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
13
+ Exclude:
14
+ - 'transaction.gemspec'
15
+
16
+ # Offense count: 1
17
+ Lint/UselessAssignment:
18
+ Exclude:
19
+ - 'spec/transaction_spec.rb'
20
+
21
+ # Offense count: 2
22
+ # Configuration parameters: CountComments, ExcludedMethods.
23
+ # ExcludedMethods: refine
24
+ Metrics/BlockLength:
25
+ Max: 20
26
+ Exclude:
27
+ - 'spec/**/*'
28
+
29
+ # Offense count: 3
30
+ Style/Documentation:
31
+ Exclude:
32
+ - 'spec/**/*'
33
+ - 'lib/transaction.rb'
34
+
35
+ # Offense count: 4
36
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
37
+ # URISchemes: http, https
38
+ Metrics/LineLength:
39
+ Max: 80
data/.travis.yml CHANGED
@@ -10,5 +10,10 @@ services:
10
10
  - redis-server
11
11
  before_install: gem install bundler -v 2.0.1
12
12
  before_script:
13
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
14
+ - chmod +x ./cc-test-reporter
15
+ - ./cc-test-reporter before-build
13
16
  script:
14
17
  bundle exec rake spec
18
+ after_script:
19
+ ./cc-test-reporter after-build
data/CHANGELOG.MD CHANGED
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.1.3] - 2019-07-18
8
+
9
+ ### Added
10
+ - Codeclimate configuration.
11
+ - Rubocop autofixes and exclude patterns.
12
+ - Enable test coverage.
13
+
14
+
7
15
  ## [0.1.2] - 2019-07-18
8
16
 
9
17
  ### Added
data/Gemfile.lock CHANGED
@@ -8,6 +8,8 @@ GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  diff-lcs (1.3)
11
+ docile (1.3.2)
12
+ json (2.2.0)
11
13
  rake (10.5.0)
12
14
  redis (4.1.2)
13
15
  rspec (3.8.0)
@@ -23,6 +25,11 @@ GEM
23
25
  diff-lcs (>= 1.2.0, < 2.0)
24
26
  rspec-support (~> 3.8.0)
25
27
  rspec-support (3.8.2)
28
+ simplecov (0.17.0)
29
+ docile (~> 1.1)
30
+ json (>= 1.8, < 3)
31
+ simplecov-html (~> 0.10.0)
32
+ simplecov-html (0.10.2)
26
33
 
27
34
  PLATFORMS
28
35
  ruby
@@ -31,6 +38,7 @@ DEPENDENCIES
31
38
  bundler (~> 2.0)
32
39
  rake (~> 10.0)
33
40
  rspec (~> 3.0)
41
+ simplecov
34
42
  transaction!
35
43
 
36
44
  BUNDLED WITH
data/lib/transaction.rb CHANGED
@@ -8,7 +8,7 @@ module Transaction
8
8
  attr_accessor :configuration
9
9
  end
10
10
 
11
- STATUSES = [:queued, :processing, :success, :error].freeze
11
+ STATUSES = %i[queued processing success error].freeze
12
12
 
13
13
  DEFAULT_ATTRIBUTES = {
14
14
  status: :queued
@@ -31,7 +31,8 @@ module Transaction
31
31
  attr_reader :transaction_id, :status, :attributes
32
32
 
33
33
  def initialize(transaction_id: nil, options: {})
34
- @transaction_id = transaction_id || "transact-#{SecureRandom.urlsafe_base64(16)}"
34
+ @transaction_id = transaction_id ||
35
+ "transact-#{SecureRandom.urlsafe_base64(16)}"
35
36
  @config = Configuration.new
36
37
 
37
38
  options = DEFAULT_ATTRIBUTES.merge(options)
@@ -85,7 +86,7 @@ module Transaction
85
86
 
86
87
  begin
87
88
  response = JSON.parse(data)
88
- raise 'Invalid response from redis. Expected Hash' unless response.is_a? Hash
89
+ raise 'Invalid type. Expected Hash' unless response.is_a? Hash
89
90
 
90
91
  response = symbolize_keys!(response)
91
92
  rescue JSON::ParserError
@@ -1,3 +1,3 @@
1
1
  module Transaction
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
data/transaction.gemspec CHANGED
@@ -14,9 +14,11 @@ Gem::Specification.new do |spec|
14
14
  spec.license = 'MIT'
15
15
 
16
16
  # Specify which files should be added to the gem when it is released.
17
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been
18
+ # added into git.
18
19
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ `git ls-files -z`.split("\x0")
21
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
20
22
  end
21
23
  spec.bindir = 'exe'
22
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -28,4 +30,5 @@ Gem::Specification.new do |spec|
28
30
  spec.add_development_dependency 'bundler', '~> 2.0'
29
31
  spec.add_development_dependency 'rake', '~> 10.0'
30
32
  spec.add_development_dependency 'rspec', '~> 3.0'
33
+ spec.add_development_dependency 'simplecov'
31
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anurag Tiwari
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Record status of long running transactions.
70
84
  email:
71
85
  - tiwari.anurag126@gmail.com
@@ -73,8 +87,11 @@ executables: []
73
87
  extensions: []
74
88
  extra_rdoc_files: []
75
89
  files:
90
+ - ".codeclimate.yml"
76
91
  - ".gitignore"
77
92
  - ".rspec"
93
+ - ".rubocop.yml"
94
+ - ".rubocop_todo.yml"
78
95
  - ".travis.yml"
79
96
  - CHANGELOG.MD
80
97
  - CODE_OF_CONDUCT.md