sourcescrub 0.0.6 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +1 -1
- data/lib/sourcescrub/apis/companies.rb +7 -0
- data/lib/sourcescrub/client.rb +25 -7
- data/lib/sourcescrub/models.rb +3 -0
- data/lib/sourcescrub/models/employee_range.rb +18 -0
- data/lib/sourcescrub/utils/request.rb +15 -3
- data/lib/sourcescrub/utils/response.rb +1 -0
- data/lib/sourcescrub/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2884125ab5a2d684096e4c2a1107ae6f561671f4122cc7cf34962b74f9e51b64
|
4
|
+
data.tar.gz: d34e3f88743020e0eb49d4a7acadeb2fe0451d6742fcbcf1651b5eee08ad3494
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0e4aca28751dbaa64568bbe53ddfae988c538b117d059d66ce5b9c2f37a13119616f2ad6d8d6e3b99d0110796eac6f0a7515e5a43cc03f184fce33c618229f7
|
7
|
+
data.tar.gz: 9c8b1e392af7cc0bbd09d81cd6421f115503deb2872a49a58ea9e1ac4efd30c0e0b6be4a439f67dcee80ef415508d9b0972b042e6edda09fa44695b2d4b021cf
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [0.1.1] - 2020-11-03
|
4
|
+
|
5
|
+
- Fixing wrong data issue of `currentEmployeeRange` in Company
|
6
|
+
|
7
|
+
## [0.0.8] - 2020-08-13
|
8
|
+
|
9
|
+
- Implement API to request all compnies - `client.companies`
|
10
|
+
|
11
|
+
## [0.0.7] - 2020-08-04
|
12
|
+
|
13
|
+
- Get source data and source compaines - `client.source_companies(source_id)`
|
14
|
+
- Get company's employeerange data by domain - `client.company_cards('monday.com', { card_id: 'employeerange' })`
|
15
|
+
- Get company's employees data by domain - `client.company_cards('monday.com', { card_id: 'employees' })`
|
16
|
+
|
3
17
|
## [0.0.3] - 2020-06-20
|
4
18
|
|
5
19
|
- Implement API to request token by user certificate
|
data/Gemfile.lock
CHANGED
data/lib/sourcescrub/client.rb
CHANGED
@@ -18,14 +18,24 @@ module Sourcescrub
|
|
18
18
|
{ 'Authorization' => "Bearer #{@token}" }
|
19
19
|
end
|
20
20
|
|
21
|
+
def companies(args = { limit: 100, offset: 0 })
|
22
|
+
api = companies_api(args)
|
23
|
+
|
24
|
+
Models::CompanyItems.new.parse_response_items(
|
25
|
+
nil,
|
26
|
+
api.kclass_name,
|
27
|
+
get(api.search_url, api.args)
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
21
31
|
def company(domain, args = {})
|
22
|
-
api =
|
32
|
+
api = company_api(domain, args)
|
23
33
|
|
24
34
|
api.sobject.parse_response get(api.request_url, api.args)
|
25
35
|
end
|
26
36
|
|
27
37
|
def company_cards(domain, args = {})
|
28
|
-
api =
|
38
|
+
api = company_api(domain, args.merge(model_type: company_card_mappings[args[:card_id]]))
|
29
39
|
|
30
40
|
Models::CompanyItems.new.parse_response_items(
|
31
41
|
domain,
|
@@ -62,22 +72,29 @@ module Sourcescrub
|
|
62
72
|
|
63
73
|
private
|
64
74
|
|
65
|
-
def companies_api(
|
66
|
-
|
75
|
+
def companies_api(args)
|
76
|
+
Apis::Companies.new(
|
77
|
+
nil,
|
78
|
+
{ model_type: 'company' }.merge(args)
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
82
|
+
def company_api(domain, args)
|
83
|
+
Apis::Companies.new(
|
67
84
|
domain,
|
68
85
|
{ model_type: 'company' }.merge(args)
|
69
86
|
)
|
70
87
|
end
|
71
88
|
|
72
89
|
def source_api(source_id, args)
|
73
|
-
|
90
|
+
Apis::Sources.new(
|
74
91
|
source_id,
|
75
92
|
{ model_type: 'source' }.merge(args)
|
76
93
|
)
|
77
94
|
end
|
78
95
|
|
79
96
|
def source_companies_api(source_id, args)
|
80
|
-
|
97
|
+
Apis::Sources.new(
|
81
98
|
source_id,
|
82
99
|
{ model_type: 'company' }.merge(args)
|
83
100
|
)
|
@@ -90,7 +107,8 @@ module Sourcescrub
|
|
90
107
|
'financials' => 'financial',
|
91
108
|
'investments' => 'investment',
|
92
109
|
'employees' => 'employee',
|
93
|
-
'tags' => 'tag'
|
110
|
+
'tags' => 'tag',
|
111
|
+
'employeerange' => 'employee_range'
|
94
112
|
}
|
95
113
|
end
|
96
114
|
end
|
data/lib/sourcescrub/models.rb
CHANGED
@@ -11,5 +11,8 @@ module Sourcescrub
|
|
11
11
|
autoload :Tag, 'sourcescrub/models/tag'
|
12
12
|
autoload :Person, 'sourcescrub/models/person'
|
13
13
|
autoload :Financial, 'sourcescrub/models/financial'
|
14
|
+
autoload :Investment, 'sourcescrub/models/investment'
|
15
|
+
autoload :Employee, 'sourcescrub/models/employee'
|
16
|
+
autoload :EmployeeRange, 'sourcescrub/models/employee_range'
|
14
17
|
end
|
15
18
|
end
|
@@ -25,14 +25,26 @@ module Sourcescrub
|
|
25
25
|
request: {
|
26
26
|
timeout: 10,
|
27
27
|
open_timeout: 5
|
28
|
-
}
|
29
|
-
|
28
|
+
},
|
29
|
+
params: args[0] || {}
|
30
|
+
).get(uri)
|
30
31
|
|
31
32
|
response_body = response.body
|
32
33
|
raise Error, response_body unless response.status == 200
|
33
34
|
|
34
35
|
response_body = JSON.parse(response_body)
|
35
|
-
|
36
|
+
# Processing different cases for investments
|
37
|
+
if response_body.is_a?(Array)
|
38
|
+
response_body = if response_body.empty?
|
39
|
+
{}
|
40
|
+
else
|
41
|
+
{
|
42
|
+
'total' => response_body.size,
|
43
|
+
'items' => response_body
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
36
48
|
response_body.merge('headers' => response.headers)
|
37
49
|
end
|
38
50
|
|
@@ -29,6 +29,7 @@ module Sourcescrub
|
|
29
29
|
# Setup attributes
|
30
30
|
attribute_names.each do |attr_name|
|
31
31
|
attr_value = response.dig(attr_name)
|
32
|
+
attr_value = nil if attr_name == 'currentEmployeeRange' && attr_value.is_a?(Integer)
|
32
33
|
|
33
34
|
dynamic_define_method(object, attr_name, attr_value)
|
34
35
|
end
|
data/lib/sourcescrub/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sourcescrub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Encore Shao
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/sourcescrub/models/concerns/entity.rb
|
113
113
|
- lib/sourcescrub/models/concerns/source_items.rb
|
114
114
|
- lib/sourcescrub/models/employee.rb
|
115
|
+
- lib/sourcescrub/models/employee_range.rb
|
115
116
|
- lib/sourcescrub/models/financial.rb
|
116
117
|
- lib/sourcescrub/models/investment.rb
|
117
118
|
- lib/sourcescrub/models/person.rb
|