roseflow-proxycurl 0.5.1 → 0.5.2

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: 9e959e41dbfffff6965201b7db95e261690df131d7e484c1f3614921ecbf00ec
4
- data.tar.gz: 3b271d3929d207f62077b76b456cc27fe84f43d900072ee85beb15bf83a4437e
3
+ metadata.gz: 103b034a550d530c2102cc3f58b57eb77a7234ab8627384f803c0589cbe510d9
4
+ data.tar.gz: 2eed18d90d8b4e72064ed842b5b41b2f6d4354629d81390b99a4b94c2b149d4b
5
5
  SHA512:
6
- metadata.gz: ca7335483100584bfb191fe6591882702430f2d1648f7149ac9b8492dffaf8a4af39158ea2beaee13df47c33d64dd9ad8707ffd3ad52079c16512a2f4dca70d6
7
- data.tar.gz: d7d1883f5caad07f9526850d1ae27bb3e000cf59f288359b5febdaea2b92d53eaa5f43cb89ff629646d48b056e86199560b3999b3c5d9c8e7434d2c07e6f539a
6
+ metadata.gz: efc137f852a75be1fded5a9564347664fc7e34d67db200550d84d7add9619edaf66b4156ba9716a4f95f440aa2241eb8330157c90127e566112c0b203ae2a18b
7
+ data.tar.gz: 39d4d1627f0a33d9756a70747d385940416caec9596b9063f07f3e279a58e301308a0e9e71bf6202428a3b875228a1a3518efeda0f9405a31a1da92218c3a6f1
@@ -6,20 +6,20 @@ require "roseflow/linkedin/company/lookup_query"
6
6
  module Roseflow
7
7
  module LinkedIn
8
8
  class Company
9
- def initialize(connection)
10
- @connection = connection
9
+ def initialize(client = Roseflow::Proxycurl::Client.new)
10
+ @client = client
11
11
  end
12
12
 
13
13
  def find(url, **options)
14
14
  query = ProfileQuery.new(url: url, **options)
15
- response = @connection.get("linkedin/company", query.to_h)
15
+ response = @client.find_company(query)
16
16
  return Company::Object.new(JSON.parse(response.body).merge("profile_url" => url)) if company_found?(response)
17
17
  return nil if company_not_found?(response)
18
18
  end
19
19
 
20
20
  def lookup(query)
21
21
  query = LookupQuery.new(query)
22
- response = @connection.get("linkedin/company/resolve", query.to_request_params)
22
+ response = @client.lookup_company(query)
23
23
  return JSON.parse(response.body).dig("url") if company_found?(response)
24
24
  return nil if company_not_found?(response)
25
25
  end
@@ -7,27 +7,27 @@ require "roseflow/linkedin/person/role_query"
7
7
  module Roseflow
8
8
  module LinkedIn
9
9
  class Person
10
- def initialize(connection)
11
- @connection = connection
10
+ def initialize(client = Roseflow::Proxycurl::Client.new)
11
+ @client = client
12
12
  end
13
13
 
14
14
  def find(url, **options)
15
15
  query = ProfileQuery.new(url: url, **options)
16
- response = @connection.get("v2/linkedin", query.to_h)
16
+ response = @client.find_person(query)
17
17
  return Person::Object.new(JSON.parse(response.body).merge(profile_url: url)) if person_found?(response)
18
18
  return nil if person_not_found?(response)
19
19
  end
20
20
 
21
21
  def lookup(query)
22
22
  query = LookupQuery.new(query)
23
- response = @connection.get("linkedin/profile/resolve", query.to_request_params)
23
+ response = @client.lookup_person(query)
24
24
  return JSON.parse(response.body).dig("url") if person_found?(response)
25
25
  return nil if person_not_found?(response)
26
26
  end
27
27
 
28
28
  def role(query)
29
29
  query = RoleQuery.new(query)
30
- response = @connection.get("find/company/role/", query.to_request_params)
30
+ response = @client.find_person_in_role(query)
31
31
  if person_found?(response)
32
32
  url = JSON.parse(response.body).dig("linkedin_profile_url")
33
33
  return find(url)
@@ -1,12 +1,36 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "roseflow/proxycurl/config"
4
+
3
5
  module Roseflow
4
6
  module Proxycurl
5
7
  class Client
8
+ attr_reader :config
9
+
6
10
  def initialize(config = Config.new)
7
11
  @config = config
8
12
  end
9
13
 
14
+ def find_person(query)
15
+ connection.get("v2/linkedin", query.to_h)
16
+ end
17
+
18
+ def find_person_in_role(query)
19
+ connection.get("find/company/role/", query.to_request_params)
20
+ end
21
+
22
+ def lookup_person(query)
23
+ connection.get("linkedin/profile/resolve", query.to_request_params)
24
+ end
25
+
26
+ def find_company(query)
27
+ connection.get("linkedin/company", query.to_h)
28
+ end
29
+
30
+ def lookup_company(query)
31
+ connection.get("linkedin/company/resolve", query.to_request_params)
32
+ end
33
+
10
34
  private
11
35
 
12
36
  def connection
@@ -9,7 +9,7 @@ module Roseflow
9
9
  module VERSION
10
10
  MAJOR = 0
11
11
  MINOR = 5
12
- PATCH = 1
12
+ PATCH = 2
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
@@ -1,10 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "proxycurl/version"
4
+ require "roseflow/proxycurl/client"
5
+ require "roseflow/proxycurl/config"
6
+ require "roseflow/proxycurl/object"
7
+
8
+ require "roseflow/linkedin/company"
9
+ require "roseflow/linkedin/job"
10
+ require "roseflow/linkedin/job_list_entry"
11
+ require "roseflow/linkedin/person"
4
12
 
5
13
  module Roseflow
6
14
  module Proxycurl
7
15
  class Error < StandardError; end
8
- # Your code goes here...
9
16
  end
10
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roseflow-proxycurl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lauri Jutila
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-23 00:00:00.000000000 Z
11
+ date: 2023-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport