firmapi 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
  SHA1:
3
- metadata.gz: fd107cae8498f72c5c589eb7f5aac3a2d498aed0
4
- data.tar.gz: 5bbddbc55ea4b9ad0372a87ee4d82256e4511def
3
+ metadata.gz: 08b93139c36bc91b8b40a9afeab73add50e54085
4
+ data.tar.gz: 06ec6c20964bbe15df7e896402153986a245f79d
5
5
  SHA512:
6
- metadata.gz: 00511e1b43993c5babfee4ea3e006b1e4fa34db0cc99c2263d00c7d18b752404bbed31badc5a97ac15f1b72cea2438f06b72b1fd5cd77b2e1f7435d568953180
7
- data.tar.gz: 197ea5237085fb3a5676b1ba4faeec450bf1fa143748e86904c282c48174b85c1425759694bfd73f6c4e776737f05fb5ac98d5cfe304be42342a776c47728304
6
+ metadata.gz: 750139078fe186b3a022dabe4250772fc7e1cf7cc2e1cabf62206a18f216889ba773d492f190981671c860d5cec4306a22220da6c466b3bd8d8094ca919e58c3
7
+ data.tar.gz: 178fd2b97bc873c6fe527b2afb0317170c50779de87df6ea367a0a392b83ce3d95d8bfb5b643cad7aa6084b9ee3c072916dc75a59dee5d138a8b0742a50ab6c3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- firmapi (0.1.1)
4
+ firmapi (0.1.3)
5
5
  faraday (~> 0.9)
6
6
  faraday_middleware (~> 0.9)
7
7
  virtus (~> 1.0)
@@ -16,19 +16,30 @@ GEM
16
16
  thread_safe (~> 0.3, >= 0.3.1)
17
17
  coercible (1.0.0)
18
18
  descendants_tracker (~> 0.0.1)
19
+ coveralls (0.7.0)
20
+ multi_json (~> 1.3)
21
+ rest-client
22
+ simplecov (>= 0.7)
23
+ term-ansicolor
24
+ thor
19
25
  crack (0.4.2)
20
26
  safe_yaml (~> 1.0.0)
21
27
  descendants_tracker (0.0.4)
22
28
  thread_safe (~> 0.3, >= 0.3.1)
23
29
  diff-lcs (1.2.5)
30
+ docile (1.1.3)
24
31
  equalizer (0.0.9)
25
32
  faraday (0.9.0)
26
33
  multipart-post (>= 1.2, < 3)
27
34
  faraday_middleware (0.9.1)
28
35
  faraday (>= 0.7.4, < 0.10)
29
36
  ice_nine (0.11.0)
37
+ mime-types (2.3)
38
+ multi_json (1.10.1)
30
39
  multipart-post (2.0.0)
31
40
  rake (10.1.1)
41
+ rest-client (1.6.7)
42
+ mime-types (>= 1.16)
32
43
  rspec (2.99.0)
33
44
  rspec-core (~> 2.99.0)
34
45
  rspec-expectations (~> 2.99.0)
@@ -38,7 +49,16 @@ GEM
38
49
  diff-lcs (>= 1.1.3, < 2.0)
39
50
  rspec-mocks (2.99.0)
40
51
  safe_yaml (1.0.3)
52
+ simplecov (0.8.2)
53
+ docile (~> 1.1.0)
54
+ multi_json
55
+ simplecov-html (~> 0.8.0)
56
+ simplecov-html (0.8.0)
57
+ term-ansicolor (1.3.0)
58
+ tins (~> 1.0)
59
+ thor (0.19.1)
41
60
  thread_safe (0.3.4)
61
+ tins (1.3.0)
42
62
  vcr (2.9.2)
43
63
  virtus (1.0.2)
44
64
  axiom-types (~> 0.1)
@@ -54,6 +74,7 @@ PLATFORMS
54
74
 
55
75
  DEPENDENCIES
56
76
  bundler (~> 1.3)
77
+ coveralls
57
78
  firmapi!
58
79
  rake (~> 10.1.0)
59
80
  rspec (~> 2.99)
data/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Firmapi
2
- [![Code Climate](https://codeclimate.com/github/EtienneDepaulis/firmapi.png)](https://codeclimate.com/github/EtienneDepaulis/firmapi) [![CircleCI](https://circleci.com/gh/EtienneDepaulis/firmapi.png)](https://circleci.com/gh/etiennedepaulis/firmapi)
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/firmapi.svg)](http://badge.fury.io/rb/firmapi) [![CI Build Status](https://secure.travis-ci.org/EtienneDepaulis/firmapi.png?branch=master)][travis] [![Code Climate](https://codeclimate.com/github/EtienneDepaulis/firmapi.png)][codeclimate] [![Coverage Status](https://coveralls.io/repos/EtienneDepaulis/firmapi/badge.png?branch=master)][coveralls]
4
+
5
+ [rubygems]: http://rubygems.org/gems/firmapi
6
+ [travis]: http://travis-ci.org/EtienneDepaulis/firmapi
7
+ [codeclimate]: https://codeclimate.com/github/EtienneDepaulis/firmapi
8
+ [coveralls]: https://coveralls.io/r/EtienneDepaulis/firmapi?branch=master
3
9
 
4
10
  Firmapi is a ruby client for [Firmapi](https://firmapi.com/) JSON API.
5
11
 
data/firmapi.gemspec CHANGED
@@ -22,6 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rspec", '~> 2.99'
23
23
  spec.add_development_dependency "vcr", '~> 2.9'
24
24
  spec.add_development_dependency "webmock", '~> 1.18'
25
+ spec.add_development_dependency "coveralls"
26
+
25
27
  spec.add_runtime_dependency "faraday", '~> 0.9'
26
28
  spec.add_runtime_dependency "faraday_middleware", '~> 0.9'
27
29
  spec.add_runtime_dependency "virtus", '~> 1.0'
data/lib/firmapi.rb CHANGED
@@ -1,13 +1,13 @@
1
- require "firmapi/version"
2
-
3
1
  module Firmapi
4
2
 
5
3
  require 'virtus'
6
4
  require 'faraday'
7
5
  require 'faraday_middleware'
8
6
 
7
+ require "firmapi/version"
9
8
  require 'firmapi/api'
10
9
  require 'firmapi/configuration'
10
+ require 'firmapi/financial_year'
11
11
  require 'firmapi/companies'
12
12
  require 'firmapi/company'
13
13
 
@@ -38,7 +38,7 @@ module Firmapi
38
38
  companies = self.new(json["result"]["search"], params)
39
39
 
40
40
  json["result"]["list"].each do |company_info|
41
- companies.add_company Firmapi::Company.new company_info
41
+ companies.add_company Company.new(company_info)
42
42
  end
43
43
 
44
44
  companies
@@ -17,6 +17,7 @@ module Firmapi
17
17
  attribute :registration_date, Date
18
18
  attribute :cessation_date, Date
19
19
  attribute :website, String
20
+ attribute :financial_activity, Array[FinancialYear]
20
21
 
21
22
  def self.find_by_siren!(siren)
22
23
 
@@ -0,0 +1,12 @@
1
+ module Firmapi
2
+ class FinancialYear
3
+ include Virtus.model
4
+
5
+ attribute :publication_year, Integer
6
+ attribute :turnover, String
7
+ attribute :income, String
8
+ attribute :workforce_count, Integer
9
+ attribute :publication_date, Date
10
+
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Firmapi
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -12,10 +12,10 @@ describe Firmapi::Company do
12
12
 
13
13
  subject(:companies) { @companies }
14
14
 
15
- it { expect(subject.results).to eq 103307 }
16
- it { expect(subject.size).to eq 100 }
17
- it { expect(subject.page).to eq 1 }
18
- it { expect(subject.number_of_pages).to eq 1033 }
15
+ it { expect(companies.results).to eq 103307 }
16
+ it { expect(companies.size).to eq 100 }
17
+ it { expect(companies.page).to eq 1 }
18
+ it { expect(companies.number_of_pages).to eq 1033 }
19
19
 
20
20
  context 'list' do
21
21
 
@@ -23,10 +23,10 @@ describe Firmapi::Company do
23
23
 
24
24
  it { is_expected.to be_a Firmapi::Company }
25
25
 
26
- it { expect(subject.name).to eq("C.M.") }
27
- it { expect(subject.siren).to eq("527810279") }
28
- it { expect(subject.nic).to be_nil }
29
- it { expect(subject.commercial_name).to be_nil }
26
+ it { expect(company.name).to eq("C.M.") }
27
+ it { expect(company.siren).to eq("527810279") }
28
+ it { expect(company.nic).to be_nil }
29
+ it { expect(company.commercial_name).to be_nil }
30
30
 
31
31
  end
32
32
 
@@ -40,7 +40,7 @@ describe Firmapi::Company do
40
40
 
41
41
  subject(:companies) { @companies }
42
42
 
43
- it { expect(subject.page).to eq 2 }
43
+ it { expect(companies.page).to eq 2 }
44
44
 
45
45
  end
46
46
 
data/spec/company_spec.rb CHANGED
@@ -14,21 +14,35 @@ describe Firmapi::Company do
14
14
 
15
15
  subject(:company) { @company }
16
16
 
17
- it { expect(subject.name).to eq("Norauto France") }
18
- it { expect(subject.siren).to eq("480470152") }
19
- it { expect(subject.nic).to eq("00012") }
20
- it { expect(subject.commercial_name).to be_nil }
21
- it { expect(subject.official_name).to eq("NORAUTO FRANCE") }
22
- it { expect(subject.naf_code).to eq("4532Z") }
23
- it { expect(subject.legal_form).to eq("SAS") }
24
- it { expect(subject.address).to eq("511 589 R Des Seringats") }
25
- it { expect(subject.postal_code).to eq("59262") }
26
- it { expect(subject.city).to eq("Sainghin En Melantois") }
27
- it { expect(subject.vat_number).to eq("FR71480470152") }
28
- it { expect(subject.number_of_establishments).to eq(230) }
29
- it { expect(subject.registration_date).to eq(Date.new(2005, 1, 20)) }
30
- it { expect(subject.cessation_date).to be_nil }
31
- it { expect(subject.website).to eq("http://centres.norauto.fr/110-norauto-leers?utm_source=google\u0026utm_medium=places\u0026utm_campaign=Norauto_20121219JC") }
17
+ it { expect(company.name).to eq("Norauto France") }
18
+ it { expect(company.siren).to eq("480470152") }
19
+ it { expect(company.nic).to eq("00012") }
20
+ it { expect(company.commercial_name).to be_nil }
21
+ it { expect(company.official_name).to eq("NORAUTO FRANCE") }
22
+ it { expect(company.naf_code).to eq("4532Z") }
23
+ it { expect(company.legal_form).to eq("SAS") }
24
+ it { expect(company.address).to eq("511 589 R Des Seringats") }
25
+ it { expect(company.postal_code).to eq("59262") }
26
+ it { expect(company.city).to eq("Sainghin En Melantois") }
27
+ it { expect(company.vat_number).to eq("FR71480470152") }
28
+ it { expect(company.number_of_establishments).to eq(230) }
29
+ it { expect(company.registration_date).to eq(Date.new(2005, 1, 20)) }
30
+ it { expect(company.cessation_date).to be_nil }
31
+ it { expect(company.website).to eq("http://centres.norauto.fr/110-norauto-leers?utm_source=google\u0026utm_medium=places\u0026utm_campaign=Norauto_20121219JC") }
32
+
33
+ context 'financial_activity' do
34
+
35
+ subject(:first_financial_activity) { company.financial_activity.first }
36
+
37
+ it { expect(company.financial_activity.size).to eq(4) }
38
+
39
+ it { expect(first_financial_activity.publication_year).to eq(2012) }
40
+ it { expect(first_financial_activity.turnover).to be_nil }
41
+ it { expect(first_financial_activity.income).to be_nil }
42
+ it { expect(first_financial_activity.workforce_count).to be_nil }
43
+ it { expect(first_financial_activity.publication_date).to eq(Date.new(2012, 9, 29)) }
44
+
45
+ end
32
46
 
33
47
  end
34
48
 
data/spec/spec_helper.rb CHANGED
@@ -1,9 +1,12 @@
1
1
  require 'bundler/setup'
2
2
  require 'webmock/rspec'
3
3
  require 'vcr'
4
+ require 'coveralls'
4
5
 
5
6
  require_relative '../lib/firmapi.rb'
6
7
 
8
+ Coveralls.wear!
9
+
7
10
  VCR.configure do |c|
8
11
  c.cassette_library_dir = 'spec/cassettes'
9
12
  c.hook_into :webmock
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firmapi
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
  - Etienne Depaulis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-06 00:00:00.000000000 Z
11
+ date: 2014-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.18'
83
+ - !ruby/object:Gem::Dependency
84
+ name: coveralls
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: faraday
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -142,6 +156,7 @@ files:
142
156
  - lib/firmapi/companies.rb
143
157
  - lib/firmapi/company.rb
144
158
  - lib/firmapi/configuration.rb
159
+ - lib/firmapi/financial_year.rb
145
160
  - lib/firmapi/version.rb
146
161
  - spec/cassettes/find_companies_with_valid_siren.yml
147
162
  - spec/cassettes/find_companies_with_valid_siren_next_page.yml