ytj_client 0.3.0 → 0.3.1
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 +4 -4
- data/README.md +34 -6
- data/lib/ytj_client/version.rb +1 -1
- data/lib/ytj_client.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa1a77ac9cc9cbabe59ed8b08d9e1327521ec746
|
4
|
+
data.tar.gz: 01b105c07e565e5448d82bcd672e3bebe4588fb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adb7828d66f22bcdfd12ce61c42fb333dcc27da526e553e134990c3b2d26ee602e1760e5ca8ae8abfae7681e50fd3e03325d28cda270a61ccd3cb979d3614e0c
|
7
|
+
data.tar.gz: b32e8e0558f03d64ce80d77b18b5d84f01f049cca0dcaf43dda51978311d521095718483ec2311e356a3c48ef0ff97d7d1100bc9b50a0581a08b33b6acdf6eb7
|
data/README.md
CHANGED
@@ -18,12 +18,12 @@ Makes the API call for you and parses the relevant (in my opinion) information t
|
|
18
18
|
Add this line to your application's Gemfile:
|
19
19
|
|
20
20
|
```ruby
|
21
|
-
gem 'ytj_client'
|
21
|
+
gem 'ytj_client', '~> 0.3'
|
22
22
|
```
|
23
23
|
|
24
24
|
And then execute:
|
25
25
|
|
26
|
-
$ bundle
|
26
|
+
$ bundle install
|
27
27
|
|
28
28
|
Or install it yourself as:
|
29
29
|
|
@@ -31,11 +31,12 @@ Or install it yourself as:
|
|
31
31
|
|
32
32
|
## Usage
|
33
33
|
|
34
|
-
|
34
|
+
### fetch_company
|
35
|
+
|
36
|
+
Fetch company details with a business_id:
|
35
37
|
|
36
38
|
```ruby
|
37
39
|
require 'ytj_client'
|
38
|
-
|
39
40
|
YtjClient.fetch_company('2331972-7')
|
40
41
|
# => #Hash {
|
41
42
|
# :business_id => "2331972-7",
|
@@ -52,15 +53,42 @@ YtjClient.fetch_company('2331972-7')
|
|
52
53
|
# }
|
53
54
|
# }
|
54
55
|
```
|
56
|
+
|
57
|
+
### fetch_companies
|
58
|
+
|
59
|
+
Fetch companies between two dates.
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
require 'ytj_client'
|
63
|
+
companies = YtjClient.fetch_companies(start_date: '2017-05-01',
|
64
|
+
end_date: '2017-05-31',
|
65
|
+
options: { mode: :array })
|
66
|
+
companies.each { |company| p company.inspect }
|
67
|
+
```
|
68
|
+
|
69
|
+
### fetch_all_companies
|
70
|
+
|
71
|
+
Fetch all companies that are available in the TR API since the year 1896. This is well over 300 000 companies so it will take a while. Saves the results in a companies.csv file.
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
require 'ytj_client'
|
75
|
+
YtjClient.fetch_all_companies
|
76
|
+
```
|
77
|
+
|
55
78
|
## Version history
|
56
79
|
|
57
|
-
### 0.3.
|
80
|
+
### 0.3.1 (2017-05-31)
|
81
|
+
|
82
|
+
- Minor changes, refactoring
|
83
|
+
- Better documentation
|
84
|
+
|
85
|
+
### 0.3.0 (2017-05-31)
|
58
86
|
|
59
87
|
- Breaking changes, new API methods:
|
60
88
|
- fetch_company (fetch details of a company with business_id)
|
61
89
|
- fetch_companies (fetch companies between two dates)
|
62
90
|
- fetch_all_companies (fetch all companies since the year 1896)
|
63
|
-
- fetch_companies supports :mode argument, to save into
|
91
|
+
- fetch_companies supports :mode argument, to save into :csv or just return the :array
|
64
92
|
- Dependency updates
|
65
93
|
|
66
94
|
### 0.2.3
|
data/lib/ytj_client/version.rb
CHANGED
data/lib/ytj_client.rb
CHANGED
@@ -51,7 +51,7 @@ module YtjClient
|
|
51
51
|
end
|
52
52
|
|
53
53
|
logger.info "Fetched #{overall_fetched_companies.size} companies and saved to #{CSV_FILENAME}"
|
54
|
-
overall_fetched_companies
|
54
|
+
overall_fetched_companies.flatten
|
55
55
|
rescue
|
56
56
|
logger.error "Error fetching data from TR API: #{$!.message} - #{$!.backtrace}"
|
57
57
|
end
|
@@ -59,7 +59,7 @@ module YtjClient
|
|
59
59
|
def fetch_companies(start_date:, end_date:, options: {})
|
60
60
|
overall_fetched_companies = fetch_timespan(start_date: start_date, end_date: end_date, options: options)
|
61
61
|
logger.info "Fetched #{overall_fetched_companies.size} companies."
|
62
|
-
|
62
|
+
overall_fetched_companies.flatten
|
63
63
|
rescue
|
64
64
|
logger.error "Error fetching data from TR API: #{$!.message} - #{$!.backtrace}"
|
65
65
|
end
|