roseflow-proxycurl 0.5.1 → 0.5.5

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: ef00b370b8256e60e46748536f90fe178cf8c589056bb51810a598bd83a62255
4
+ data.tar.gz: 872a9ced3159e8ebd216821add1e1a7861bdb2f3e77bb6384177bc6c262d4bf6
5
5
  SHA512:
6
- metadata.gz: ca7335483100584bfb191fe6591882702430f2d1648f7149ac9b8492dffaf8a4af39158ea2beaee13df47c33d64dd9ad8707ffd3ad52079c16512a2f4dca70d6
7
- data.tar.gz: d7d1883f5caad07f9526850d1ae27bb3e000cf59f288359b5febdaea2b92d53eaa5f43cb89ff629646d48b056e86199560b3999b3c5d9c8e7434d2c07e6f539a
6
+ metadata.gz: 7967a36086fa26375c7c2459daef8cc8c7f57a7c92ca259e55d4edf44c98fdcb0b814c68d7e9a269c2de24ac8665eb1b0dea8a3991667e055632245ff7b49e9b
7
+ data.tar.gz: a74375c8d96e46a8bfa73d1f0889bdca7ec5aa12824d67292c0feb3c77e0284d18367b0ac83038605e8e48313a57bdd0dd22b351a1925b453846ee96c8d45a31
@@ -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
@@ -37,10 +37,10 @@ module Roseflow
37
37
  params do
38
38
  required(:title).filled(:string)
39
39
  required(:company).filled(:string)
40
- optional(:company_profile_url).filled(:string)
40
+ optional(:company_profile_url)
41
41
  optional(:location)
42
42
  optional(:description)
43
- optional(:started_on).filled(:date)
43
+ optional(:started_on)
44
44
  optional(:ended_on)
45
45
  end
46
46
 
@@ -55,7 +55,7 @@ module Roseflow
55
55
  attribute? :company_profile_url, Types::StringOrNil
56
56
  attribute? :location, Types::StringOrNil
57
57
  attribute? :description, Types::StringOrNil
58
- attribute :started_on, Types::Date
58
+ attribute? :started_on, Types::DateOrNil
59
59
  attribute? :ended_on, Types::DateOrNil
60
60
 
61
61
  contract_object ExperienceContract
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "roseflow/linkedin/person/object"
3
4
  require "roseflow/linkedin/person/lookup_query"
4
5
  require "roseflow/linkedin/person/profile_query"
5
6
  require "roseflow/linkedin/person/role_query"
@@ -7,27 +8,27 @@ require "roseflow/linkedin/person/role_query"
7
8
  module Roseflow
8
9
  module LinkedIn
9
10
  class Person
10
- def initialize(connection)
11
- @connection = connection
11
+ def initialize(client = Roseflow::Proxycurl::Client.new)
12
+ @client = client
12
13
  end
13
14
 
14
15
  def find(url, **options)
15
16
  query = ProfileQuery.new(url: url, **options)
16
- response = @connection.get("v2/linkedin", query.to_h)
17
+ response = @client.find_person(query)
17
18
  return Person::Object.new(JSON.parse(response.body).merge(profile_url: url)) if person_found?(response)
18
19
  return nil if person_not_found?(response)
19
20
  end
20
21
 
21
22
  def lookup(query)
22
23
  query = LookupQuery.new(query)
23
- response = @connection.get("linkedin/profile/resolve", query.to_request_params)
24
+ response = @client.lookup_person(query)
24
25
  return JSON.parse(response.body).dig("url") if person_found?(response)
25
26
  return nil if person_not_found?(response)
26
27
  end
27
28
 
28
29
  def role(query)
29
30
  query = RoleQuery.new(query)
30
- response = @connection.get("find/company/role/", query.to_request_params)
31
+ response = @client.find_person_in_role(query)
31
32
  if person_found?(response)
32
33
  url = JSON.parse(response.body).dig("linkedin_profile_url")
33
34
  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 = 5
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.5
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-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport