perfect_audit 0.1.4 → 0.1.5

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
  SHA1:
3
- metadata.gz: ceafd6ae46f87c894c14085f871fc4df2e603f7f
4
- data.tar.gz: 0ea089df9cda44d885a502a20f7861c008f707d2
3
+ metadata.gz: c27162da2493ec3c5cb9c76efba6afdf19c1d3d6
4
+ data.tar.gz: c6acc4f247e2ca65ac99fac7c0943b0181942e6e
5
5
  SHA512:
6
- metadata.gz: f246ff012da04684ea4c81f1b89e715f0a15c6f822673cba4f3a9d973867104f0a3492f4148e01f0f2b4f84d0f3f31b8f56d642e5fd127b6188016268593302f
7
- data.tar.gz: 126db5d658d7eace2b300694daafef4241aa4126b98af64e1c901a418dc5ebddc500073c71fa28b323e1b5aec13bfa5fa8e5e6d3dde9620658bcd32b07e3a95a
6
+ metadata.gz: 48185fc4598fdb07d82c608ecf3f0c8f3346a1006d2b2e90c5e232f720740488d5d319c4d016401af9958d2b6fc04112ca8cbb821b5acd74756c3c1271216e32
7
+ data.tar.gz: fe881555598c659e6d5dc0a10b39e74c9d6481def29d80efeb4bf09e9f757d24a1302a3e95f01a2e7d93ce3a2d989c075cd5da8f9ab367b88ed511111a6cc1e2
data/.travis.yml CHANGED
@@ -1,5 +1,16 @@
1
+ env:
2
+ global:
3
+ - CC_TEST_REPORTER_ID=24546387ff2f87f378547f02b17ffd3a3122318515ac614dd38f3607684d87ae
1
4
  language: ruby
2
5
  rvm:
3
6
  - 2.4
4
7
  - 2.5
5
8
  before_install: gem install bundler -v 1.11.2
9
+ before_script:
10
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
11
+ - chmod +x ./cc-test-reporter
12
+ - ./cc-test-reporter before-build
13
+ script:
14
+ - bundle exec rspec
15
+ after_script:
16
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # PerfectAudit
2
2
 
3
3
  [![Build Status](https://travis-ci.org/igor-alexandrov/perfect_audit.svg?branch=master)](https://travis-ci.org/igor-alexandrov/perfect_audit)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/72f40b05552e16b9cd4f/maintainability)](https://codeclimate.com/github/igor-alexandrov/perfect_audit/maintainability)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/72f40b05552e16b9cd4f/test_coverage)](https://codeclimate.com/github/igor-alexandrov/perfect_audit/test_coverage)
4
6
 
5
7
  Perfect Audit API wrapper.
6
8
 
@@ -26,8 +28,8 @@ Or install it yourself as:
26
28
 
27
29
  ``` ruby
28
30
  PerfectAudit.configure do |config|
29
- config[:api_key] = 'your_api_key'
30
- config[:api_secret] = 'your_api_secret'
31
+ config.api_key = 'your_api_key'
32
+ config.api_secret = 'your_api_secret'
31
33
  end
32
34
  ```
33
35
 
@@ -67,16 +69,11 @@ Upload document to a book:
67
69
  PerfectAudit.documents.create(book_or_id, file_or_io)
68
70
  ```
69
71
 
70
- ## Development
72
+ ## Credits
71
73
 
72
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
73
-
74
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
75
-
76
- ## Contributing
77
-
78
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/perfect_audit.
74
+ Sponsored by [JetRockets](http://www.jetrockets.pro).
79
75
 
76
+ ![JetRockets](http://jetrockets.pro/JetRockets.jpg)
80
77
 
81
78
  ## License
82
79
 
data/lib/perfect_audit.rb CHANGED
@@ -26,14 +26,13 @@ module PerfectAudit
26
26
  # PerfectAudit::TransactionsRepository.new
27
27
  # end
28
28
 
29
- # private
29
+ private
30
30
 
31
31
  def register!
32
32
  connection = PerfectAudit::Connection.new(configuration.to_h)
33
33
 
34
34
  container.register :connection, -> { connection }
35
35
  container.register :response_parser, -> { PerfectAudit::ResponseParser }
36
- # container.freeze
37
36
  end
38
37
  end
39
38
 
@@ -0,0 +1,14 @@
1
+ module PerfectAudit
2
+ class Error < StandardError
3
+ attr_reader :code
4
+
5
+ def initialize(message, code)
6
+ @code = code
7
+ super(message)
8
+ end
9
+
10
+ def to_s
11
+ super + " [#{@code}]"
12
+ end
13
+ end
14
+ end
@@ -1,11 +1,12 @@
1
1
  require 'ostruct'
2
+ require 'perfect_audit/error'
2
3
 
3
4
  module PerfectAudit
4
5
  class ResponseParser
5
6
  def self.parse(response)
6
7
  struct = OpenStruct.new(JSON.parse(response))
7
8
 
8
- raise StandardError, struct.message if struct.status != 200
9
+ raise PerfectAudit::Error.new(struct.message, struct.code) if struct.status != 200
9
10
 
10
11
  case struct.response
11
12
  when Hash
@@ -1,3 +1,3 @@
1
1
  module PerfectAudit
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency 'bundler', "~> 1.11"
33
33
 
34
34
  spec.add_development_dependency 'factory_bot'
35
+ spec.add_development_dependency 'faker'
35
36
 
36
37
  spec.add_development_dependency 'pry'
37
38
 
@@ -39,5 +40,7 @@ Gem::Specification.new do |spec|
39
40
  spec.add_development_dependency 'rspec', "~> 3.0"
40
41
  spec.add_development_dependency 'rspec-collection_matchers'
41
42
 
43
+ spec.add_development_dependency 'simplecov'
44
+
42
45
  spec.add_development_dependency 'webmock'
43
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perfect_audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Alexandrov
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: faker
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: pry
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +178,20 @@ dependencies:
164
178
  - - ">="
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: simplecov
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
167
195
  - !ruby/object:Gem::Dependency
168
196
  name: webmock
169
197
  requirement: !ruby/object:Gem::Requirement
@@ -202,6 +230,7 @@ files:
202
230
  - lib/perfect_audit/api/period.rb
203
231
  - lib/perfect_audit/api/repositories.rb
204
232
  - lib/perfect_audit/connection.rb
233
+ - lib/perfect_audit/error.rb
205
234
  - lib/perfect_audit/response_parser.rb
206
235
  - lib/perfect_audit/version.rb
207
236
  - perfect_audit.gemspec