sourcescrub 0.0.3 → 0.0.4

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
  SHA256:
3
- metadata.gz: 545d2b8b334ea07bbe2685f9a3b6d272aac07d1bf844b5193cd8253359365ba6
4
- data.tar.gz: 49b57da12028f5755a3339451eda02029f65e66b5adb594d2b097434d526fa5f
3
+ metadata.gz: 847e87ea8785f58f62705fb85098c4aaca5fe6bd07887a2f498009c46b404710
4
+ data.tar.gz: 23d25cb69ca12230ae30079d766d09d06ac6a2322f62cb937ce32db8ad0d723d
5
5
  SHA512:
6
- metadata.gz: 1d75bb44c81093c2d4ce1a757a5c83741c8b7f0699625cb7551d17fb87b4828aec2e7515ccfc1a771d38de96c78aaa88f7d860c7782c051dd5f4185f3247a0f5
7
- data.tar.gz: 8d2bf71686def7d5743d537babfab8eba380584aa0654dd33f92cbaac424b6e559df15e352da1aaae5856404b39335165e25a689b366631ddb328443f3dcc83d
6
+ metadata.gz: 350a941ef5e4b7d3c97e2056b0b45a93748321b8613912bc16ffc7e773d8e8199b7bc6209137923b331514daa7f0a61b8b367d78901e8a09e8b369a49fc6ae35
7
+ data.tar.gz: 1afa30a66e342346e2afed1e4e8d35d70b4d7e73ffe0862a49f26db4034865810311721f2e5a4f9fc22c44eb5ba467897c2ccd84183e9d1fbae82e2bf4964eb8
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sourcescrub (0.0.3)
4
+ sourcescrub (0.0.4)
5
5
  faraday
6
6
  faraday_middleware
7
7
 
data/README.md CHANGED
@@ -61,8 +61,7 @@ pry(main)> client.headers
61
61
 
62
62
  ```ruby
63
63
  <!-- Company -->
64
- response = client.companies('ekohe.com')
65
- response = client.company_cards('ekohe.com', { card_id: 'sources' })
64
+ response = client.company('ekohe.com')
66
65
 
67
66
  <!-- Get the JSON response of Company -->
68
67
 
@@ -74,8 +73,8 @@ response.as_json
74
73
  #### Get the company data
75
74
 
76
75
  ```ruby
77
- pry(main)> response = client.companies('ekohe.com')
78
- pry(main)> #<Sourcescrub::Models::Company:0x00007fcd31bcd238
76
+ pry(main)> response = client.company('ekohe.com')
77
+ => #<Sourcescrub::Models::Company:0x00007f9e915161c0
79
78
  @city="Xinzhuang",
80
79
  @companyType="Private",
81
80
  @country="China",
@@ -87,19 +86,87 @@ pry(main)> #<Sourcescrub::Models::Company:0x00007fcd31bcd238
87
86
  "Ekohe, Ltd. is a cutting-edge web and mobile design and development agency. It specialize in digital strategy, innovative technology and user-centered design experiences from conceptualization to market launch.",
88
87
  @domain="ekohe.com",
89
88
  @facebook=nil,
89
+ => #<Sourcescrub::Models::Company:0x00007f9e915161c0
90
+ @city="Xinzhuang",
91
+ @companyType="Private",
92
+ @country="China",
93
+ @crunchbase=nil,
94
+ @currentEmployeeCount=41,
95
+ @currentEmployeeRange="11-50",
96
+ @currentJobOpenings=0,
97
+ @description=
98
+ "Ekohe, Ltd. is a cutting-edge web and mobile design and development agency. It specialize in digital strategy, innovative technology and user-centered design experiences from conceptualization to market la
99
+ unch.",
100
+ @domain="ekohe.com",
101
+ @facebook=nil,
90
102
  @firmTags=[],
91
103
  @foundingYear=2007,
92
104
  @id="LZ281NVD",
93
105
  @informalName="Ekohe",
94
- @investors=nil,
106
+ @investors="",
95
107
  @linkedIn="https://www.linkedin.com/company/ekohe",
96
108
  @location="Xinzhuang, Shanghai Shi, China",
97
109
  @name="Ekohe, Ltd.",
98
- .....>
110
+ @parentCompanyDomain=nil,
111
+ @personalTags=[],
112
+ @phoneNumber="",
113
+ @postalCode=nil,
114
+ @specialties=
115
+ ["IT & Startup Consulting",
116
+ "Ruby on Rails leaders",
117
+ "Intelligent Web & Mobile Development",
118
+ "Usable Web & Mobile design",
119
+ "UX or UI Design",
120
+ "Artificial Intelligence",
121
+ "Machine Learning",
122
+ "Data Sourcing",
123
+ "FinTech Tools"],
124
+ @state="Shanghai Shi",
125
+ @totalAmountInvested=0,
126
+ @twitter=nil,
127
+ @website="https://ekohe.com">
99
128
  pry(main)> response.name
100
129
  => "Ekohe, Ltd."
101
130
  pry(main)> response.domain
102
131
  => "ekohe.com"
132
+ pry(main)> response.as_json
133
+ => {:id=>"LZ281NVD",
134
+ :companyType=>"Private",
135
+ :name=>"Ekohe, Ltd.",
136
+ :informalName=>"Ekohe",
137
+ :website=>"https://ekohe.com",
138
+ :domain=>"ekohe.com",
139
+ :description=>
140
+ "Ekohe, Ltd. is a cutting-edge web and mobile design and development agency. It specialize in digital strategy, innovative technology and user-centered design experiences from conceptualization to market launch.",
141
+ :foundingYear=>2007,
142
+ :location=>"Xinzhuang, Shanghai Shi, China",
143
+ :city=>"Xinzhuang",
144
+ :state=>"Shanghai Shi",
145
+ :postalCode=>nil,
146
+ :country=>"China",
147
+ :parentCompanyDomain=>nil,
148
+ :phoneNumber=>"",
149
+ :specialties=>
150
+ ["IT & Startup Consulting",
151
+ "Ruby on Rails leaders",
152
+ "Intelligent Web & Mobile Development",
153
+ "Usable Web & Mobile design",
154
+ "UX or UI Design",
155
+ "Artificial Intelligence",
156
+ "Machine Learning",
157
+ "Data Sourcing",
158
+ "FinTech Tools"],
159
+ :facebook=>nil,
160
+ :twitter=>nil,
161
+ :crunchbase=>nil,
162
+ :linkedIn=>"https://www.linkedin.com/company/ekohe",
163
+ :totalAmountInvested=>0,
164
+ :currentEmployeeCount=>41,
165
+ :currentEmployeeRange=>"11-50",
166
+ :currentJobOpenings=>0,
167
+ :investors=>"",
168
+ :personalTags=>[],
169
+ :firmTags=>[]}
103
170
  ```
104
171
 
105
172
  ### Searches
@@ -12,7 +12,7 @@ module Sourcescrub
12
12
  attr_accessor :token
13
13
 
14
14
  def headers
15
- @token || authenticate
15
+ authenticate if @token.nil?
16
16
 
17
17
  { 'Authorization' => "Bearer #{@token}" }
18
18
  end
@@ -9,5 +9,6 @@ module Sourcescrub
9
9
  autoload :Source, 'sourcescrub/models/source'
10
10
  autoload :Tag, 'sourcescrub/models/tag'
11
11
  autoload :Person, 'sourcescrub/models/person'
12
+ autoload :Financial, 'sourcescrub/models/financial'
12
13
  end
13
14
  end
@@ -17,8 +17,8 @@ module Sourcescrub
17
17
 
18
18
  dynamic_define_method(self, 'domain', domain)
19
19
  dynamic_define_method(self, 'type', kclass_name)
20
- dynamic_define_method(self, 'total', response.dig(total_key))
21
- dynamic_define_method(self, 'items', company_items(kclass_name, response.dig(items_key)))
20
+ dynamic_define_method(self, 'total', response.dig(total_key) || 0)
21
+ dynamic_define_method(self, 'items', company_items(kclass_name, response.dig(items_key) || []))
22
22
  self
23
23
  end
24
24
 
@@ -33,9 +33,14 @@ module Sourcescrub
33
33
  faraday.response :logger, ::Logger.new(STDOUT), bodies: true if debug_mode?
34
34
  end.get(uri, *args)
35
35
 
36
- return response.body.merge('headers' => response.headers) if response.status == 200
36
+ response_body = response.body
37
+ if response.status == 200
38
+ response_body = {} if response_body.is_a?(Array) && response_body.empty?
37
39
 
38
- raise Error, response.body
40
+ return response_body.merge('headers' => response.headers)
41
+ end
42
+
43
+ raise Error, response_body
39
44
  end
40
45
 
41
46
  # def put(uri, args)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sourcescrub
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
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.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Encore Shao
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-20 00:00:00.000000000 Z
11
+ date: 2020-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -143,7 +143,7 @@ metadata:
143
143
  homepage_uri: https://github.com/ekohe/sourcescrub
144
144
  source_code_uri: https://github.com/ekohe/sourcescrub
145
145
  changelog_uri: https://github.com/ekohe/sourcescrub/blob/master/CHANGELOG.md
146
- post_install_message:
146
+ post_install_message:
147
147
  rdoc_options: []
148
148
  require_paths:
149
149
  - lib
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubygems_version: 3.0.3
162
- signing_key:
162
+ signing_key:
163
163
  specification_version: 4
164
164
  summary: Sourcescrub is a ruby wrapper based on Source Scrub API.
165
165
  test_files: []