ares.rb 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc12e73b00e926a9fe1aca8470f37035d7b0bad9
4
- data.tar.gz: 57a22b7e8d142fe1cbc7bdd5491b67a168760c58
3
+ metadata.gz: f41042921987c9163929035bfdfa9593cca85c9f
4
+ data.tar.gz: 6cc85f6c34334268ec3ac26cdd0810b8e204fb67
5
5
  SHA512:
6
- metadata.gz: 62ae8f22d35b9df1de3fbe5832f62980760d184fc00101ce1fcb54742c7512405aa7b5127bf85d00b1dc4e034bea5819d05a7d3af3d3c1023b1db653bee45e1b
7
- data.tar.gz: 5ff88e73f91c694e86dbe63eee9267c3d5aaa5ce48e472dc3e036324d0e9fb98b47611fe96f3501155a8f134c22486dbe40102fb61994a049dee19e3fa942997
6
+ metadata.gz: e477eee41910c2a724ad9647d1a3e23b66dd163992f8c2a50a3eb0da608df088af9abcd2d8ddc2b3f2801379e49b69db32670347b34b9a26c00ff3e1ef39b149
7
+ data.tar.gz: e017f3462ad6ce5a7a82ed0aa791e59964946c57cb23ba49ecda8380f381964a8bd3d534984b8d001018c578527c5368346eb52987784b153ce606e3c3f67933
@@ -0,0 +1,4 @@
1
+ # Prefer single quotes
2
+ StringLiterals:
3
+ EnforcedStyle: single_quotes
4
+ Enabled: true
@@ -1,6 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.2.2
3
4
  - 2.2.1
4
5
  - 2.0.0
5
- - 1.9.3
6
6
  script: bundle exec rspec
7
+ addons:
8
+ code_climate:
9
+ repo_token: 6a9c9df74fe9e772f1d98e955eaacd1804985c563ede95f401962917112884bf
data/README.md CHANGED
@@ -1,18 +1,19 @@
1
1
  # Ares
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/cnb.png)](http://badge.fury.io/rb/cnb)
3
+ [![Gem Version](https://badge.fury.io/rb/ares.rb.png)](http://badge.fury.io/rb/ares.rb)
4
4
  [![Build Status](https://travis-ci.org/ucetnictvi-on-line/ares.rb.png?branch=master)](https://travis-ci.org/ucetnictvi-on-line/ares.rb)
5
+ [![Dependency Status](https://gemnasium.com/ucetnictvi-on-line/ares.rb.svg)](https://gemnasium.com/ucetnictvi-on-line/ares.rb)
5
6
  [![Code Climate](https://codeclimate.com/github/ucetnictvi-on-line/ares.rb/badges/gpa.svg)](https://codeclimate.com/github/ucetnictvi-on-line/ares.rb)
6
7
  [![Test Coverage](https://codeclimate.com/github/ucetnictvi-on-line/ares.rb/badges/coverage.svg)](https://codeclimate.com/github/ucetnictvi-on-line/ares.rb/coverage)
7
8
 
8
- Load information about employers from Czech ARES service.
9
+ Ruby client for Czech Registers of Economic Subjects - [ARES](https://cs.wikipedia.org/wiki/Administrativn%C3%AD_registr_ekonomick%C3%BDch_subjekt%C5%AF)
9
10
 
10
11
  ## Installation
11
12
 
12
13
  Add this line to your application's Gemfile:
13
14
 
14
15
  ```ruby
15
- gem 'ares'
16
+ gem 'ares.rb'
16
17
  ```
17
18
 
18
19
  And then execute:
@@ -21,7 +22,7 @@ And then execute:
21
22
 
22
23
  Or install it yourself as:
23
24
 
24
- $ gem install ares
25
+ $ gem install ares.rb
25
26
 
26
27
  ## Usage
27
28
 
@@ -40,7 +41,7 @@ record.address.district # => "Hlavní město Praha"
40
41
 
41
42
  ## Contributing
42
43
 
43
- 1. Fork it ( https://github.com/[my-github-username]/ares/fork )
44
+ 1. Fork it ( https://github.com/ucetnictvi-on-line/ares.rb/fork )
44
45
  2. Create your feature branch (`git checkout -b my-new-feature`)
45
46
  3. Commit your changes (`git commit -am 'Add some feature'`)
46
47
  4. Push to the branch (`git push origin my-new-feature`)
@@ -21,6 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency 'rspec'
22
22
  spec.add_development_dependency 'webmock'
23
23
  spec.add_development_dependency 'vcr'
24
+ spec.add_development_dependency 'rails'
25
+ spec.add_development_dependency 'ico-validator'
24
26
 
25
27
  spec.add_runtime_dependency 'httparty'
26
28
  spec.add_runtime_dependency 'nokogiri'
@@ -4,6 +4,7 @@ require 'ares/version'
4
4
  require 'ares/errors'
5
5
  require 'ares/logging'
6
6
  require 'ares/client'
7
+ require 'ico-validator'
7
8
 
8
9
  module Ares
9
10
  class << self
@@ -18,9 +19,19 @@ module Ares
18
19
  # @see Client::Standard#call
19
20
  # @return [Responses::StandardResponse::Record]
20
21
  def standard(options)
22
+ validate_ico_format(options[:ico])
21
23
  response = client.call(options)
22
24
  fail ArgumentError, "Arguments #{options} are invalid" if response.error?
23
25
  response.record
24
26
  end
27
+
28
+ private
29
+
30
+ def validate_ico_format(ico)
31
+ return unless ico.present?
32
+ validator = ::IcoValidator.new(attributes: [:_])
33
+ return if validator.send(:valid_ico?, ico)
34
+ fail ArgumentError, "ICO '#{ico}' is invalid"
35
+ end
25
36
  end
26
37
  end
@@ -1,3 +1,3 @@
1
1
  module Ares
2
- VERSION = "0.1.0"
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ares.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Svoboda
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-19 00:00:00.000000000 Z
12
+ date: 2015-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -81,6 +81,34 @@ dependencies:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rails
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: ico-validator
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
84
112
  - !ruby/object:Gem::Dependency
85
113
  name: httparty
86
114
  requirement: !ruby/object:Gem::Requirement
@@ -117,6 +145,7 @@ extensions: []
117
145
  extra_rdoc_files: []
118
146
  files:
119
147
  - ".gitignore"
148
+ - ".hound.yml"
120
149
  - ".rspec"
121
150
  - ".ruby-gemset"
122
151
  - ".ruby-version"