roseflow-proxycurl 0.5.0 → 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: 3c7ca7800c548f6ce3653f6293ddb1f594c88e4a1917f79fb2c7e514450e853d
4
- data.tar.gz: b958674834ce20eff5469ed53e319840c313fcaf96c2d11cabd83f644a273c38
3
+ metadata.gz: 103b034a550d530c2102cc3f58b57eb77a7234ab8627384f803c0589cbe510d9
4
+ data.tar.gz: 2eed18d90d8b4e72064ed842b5b41b2f6d4354629d81390b99a4b94c2b149d4b
5
5
  SHA512:
6
- metadata.gz: 9dbe708e052754805a27d5d144005e55694361b52a8e943f09f6861ace517fd7cb72778720f98527ec54843cbb888d60a9b9edafb788618a04d21cd585139fae
7
- data.tar.gz: a53ac1c72f93c32a5dedc529786eba92d49ec5339c2fcbfae437b32592f42a2ae570dcdb84ac4ca407823e7dda06819ed7011a9f78bfbeaa24d1c84958a7ff4e
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 = 0
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
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.require_paths = ["lib"]
31
31
 
32
32
  # Uncomment to register a new dependency of your gem
33
- spec.add_dependency "activesupport", "~> 6.0"
33
+ spec.add_dependency "activesupport"
34
34
  spec.add_dependency "anyway_config", "~> 2.0"
35
35
  spec.add_dependency "dry-struct", "~> 1.6"
36
36
  spec.add_dependency "dry-transformer", "~> 1.0"
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roseflow-proxycurl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
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-20 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
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '6.0'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '6.0'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: anyway_config
29
29
  requirement: !ruby/object:Gem::Requirement