rocket-reach 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d69ab3585d41608e2dd158e60855134281297db0cff7b387a8dda637a78d8db8
4
+ data.tar.gz: 021a3851a82b0bf6fb515f593e4832582baa00be3a50000d29b0515fe7c96e33
5
+ SHA512:
6
+ metadata.gz: 073eb42f0648c988dd20fdacfaba476ed2669c747ebcdd4f1c10cc63de5635888600f410b155fded0afd68c1abcdc7227a4821bbbc5f56567814314d08d4c20b
7
+ data.tar.gz: 7049f15375670d507b48b5e01f4c4ea89e8b9183227fc96b183f15729f3358c8d146723f6213c00218f58532c12e59ad09d1df3ce8a23706c98319adafcd25e8
@@ -0,0 +1,36 @@
1
+ version: 2.1
2
+
3
+ jobs:
4
+ max_versions:
5
+ docker:
6
+ - image: cimg/ruby:3.1.1
7
+ steps:
8
+ - checkout
9
+ - run:
10
+ name: Which bundler?
11
+ command: bundle -v
12
+ - run:
13
+ command: bundle install
14
+ - run:
15
+ command: bundle exec rspec
16
+ min_versions:
17
+ docker:
18
+ - image: cimg/ruby:2.5.9
19
+ environment:
20
+ GEM_VERSIONS: 'min'
21
+ steps:
22
+ - checkout
23
+ - run:
24
+ name: Which bundler?
25
+ command: bundle -v
26
+ - run:
27
+ command: bundle install
28
+ - run:
29
+ command: bundle exec rspec
30
+
31
+ workflows:
32
+ version: 2
33
+ build:
34
+ jobs:
35
+ - max_versions
36
+ - min_versions
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /vendor/bundle
3
+ /Gemfile.lock
4
+ /.yardoc
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+
12
+ .rspec_status
13
+ .ruby-version
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,23 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+ NewCops: enable
4
+
5
+ Style/StringLiterals:
6
+ Enabled: true
7
+ EnforcedStyle: double_quotes
8
+
9
+ Style/StringLiteralsInInterpolation:
10
+ Enabled: true
11
+ EnforcedStyle: double_quotes
12
+
13
+ Layout/LineLength:
14
+ Max: 120
15
+
16
+ Style/Documentation:
17
+ Enabled: false
18
+
19
+ Metrics/BlockLength:
20
+ Exclude: [ 'spec/*' ]
21
+
22
+ Style/FrozenStringLiteralComment:
23
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in rocket-reach.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+ gem "rspec", "~> 3.0"
10
+ gem "rubocop", "~> 1.7"
11
+ gem "rubocop-rake"
12
+ gem "rubocop-rspec"
13
+ gem "vcr", ">= 6.0.0", require: false
14
+ gem "webmock", ">= 3.10.0"
15
+
16
+ if ENV.fetch("GEM_VERSIONS", nil) == "min"
17
+ gem "activesupport", "~> 8.0"
18
+ gem "faraday", "~> 1.0.0"
19
+ gem "multi_json", "~> 1.4.0"
20
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Bapu Sethi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ [![CircleCI](https://circleci.com/gh/NEXL-LTS/rocket-reach-ruby.svg?style=svg)](https://circleci.com/gh/NEXL-LTS/rocket-reach-ruby)
2
+
3
+ # Rocket::Reach
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rocket/reach`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ TODO: Delete this and the text above, and describe your gem
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'rocket-reach'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle install
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install rocket-reach
24
+
25
+ ## Usage
26
+
27
+ TODO: Write usage instructions here
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rocket-reach.
38
+
39
+ ## License
40
+
41
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "rocket_reach"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RocketReach
4
+ class Client
5
+ class << self
6
+ def search(query: {}, start: 1, page_size: 10, order_by: "popularity")
7
+ response = connection.post("/v2/api/search") do |req|
8
+ req.headers["Content-Type"] = "application/json"
9
+ req.headers["Api-Key"] = api_key
10
+ req.body = { query: query.transform_values { |e| Array.wrap(e) },
11
+ order_by: order_by, start: start, page_size: page_size }.to_json
12
+ end
13
+ MultiJson.load(response.body)
14
+ rescue Faraday::Error => e
15
+ raise RocketReach.wrap_error(e)
16
+ end
17
+
18
+ def lookup_profile(request = {})
19
+ response = connection.get("/v2/api/lookupProfile") do |req|
20
+ req.headers["Content-Type"] = "application/json"
21
+ req.headers["Api-Key"] = api_key
22
+ req.params = request
23
+ end
24
+ MultiJson.load(response.body)
25
+ rescue Faraday::Error => e
26
+ raise RocketReach.wrap_error(e)
27
+ end
28
+
29
+ private
30
+
31
+ def api_key
32
+ configuration.api_key
33
+ end
34
+
35
+ def connection
36
+ configuration.connection
37
+ end
38
+
39
+ def configuration
40
+ RocketReach.configuration
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RocketReach
4
+ class Configuration
5
+ attr_accessor :api_key
6
+ attr_writer :connection
7
+
8
+ def connection
9
+ return @connection if @connection
10
+
11
+ @connection =
12
+ Faraday.new(url: "https://api.rocketreach.co/") do |c|
13
+ c.use Faraday::Response::RaiseError
14
+ c.options.timeout = 20 # open/read timeout in seconds
15
+ c.options.open_timeout = 20 # connection open timeout in seconds
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RocketReach
4
+ Error = Class.new(StandardError)
5
+
6
+ class HttpError < Error
7
+ attr_reader :response
8
+
9
+ def initialize(err)
10
+ @response = err.response if err.respond_to?(:response)
11
+ super(err)
12
+ end
13
+
14
+ def self.wrap(error)
15
+ new(error)
16
+ end
17
+ end
18
+
19
+ ClientError = Class.new(HttpError)
20
+ ServerError = Class.new(HttpError)
21
+
22
+ def self.wrap_error(faraday_error)
23
+ case faraday_error
24
+ when Faraday::ClientError
25
+ ClientError.new(faraday_error)
26
+ when Faraday::ServerError
27
+ ServerError.new(faraday_error)
28
+ else
29
+ HttpError.new(faraday_error)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RocketReach
4
+ VERSION = "0.3.0"
5
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "json"
5
+ require "active_support/core_ext/array/wrap"
6
+ require "multi_json"
7
+ require_relative "rocket_reach/client"
8
+ require_relative "rocket_reach/configuration"
9
+ require_relative "rocket_reach/version"
10
+ require_relative "rocket_reach/error"
11
+
12
+ module RocketReach
13
+ class << self
14
+ attr_writer :configuration
15
+ end
16
+
17
+ def self.configuration
18
+ @configuration ||= Configuration.new
19
+ end
20
+
21
+ def self.configure
22
+ yield(configuration)
23
+ end
24
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/rocket_reach/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "rocket-reach"
7
+ spec.version = RocketReach::VERSION
8
+ spec.authors = ["bapu sethi", "Connor Moot"]
9
+ spec.email = ["bapu@nexl.io", "connor@nexl.cloud"]
10
+
11
+ spec.summary = "Ruby client for connecting to Rocket Reach"
12
+ spec.description = "Ruby client for connecting to Rocket Reach"
13
+ spec.homepage = "https://github.com/NEXL-LTS/rocket-reach-ruby"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
16
+
17
+ # spec.metadata["homepage_uri"] = spec.homepage
18
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
19
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ # Uncomment to register a new dependency of your gem
31
+ spec.add_dependency "activesupport", ">= 4.1.0", "< 9.0"
32
+ spec.add_dependency "faraday", ">= 1.0.0", "< 3.0"
33
+ spec.add_dependency "multi_json", ">= 1.4.0", "< 2.0"
34
+
35
+ # For more information and examples about making a new gem, checkout our
36
+ # guide at: https://bundler.io/guides/creating_gem.html
37
+ spec.metadata["rubygems_mfa_required"] = "true"
38
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rocket-reach
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - bapu sethi
8
+ - Connor Moot
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-05-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.1.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '9.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 4.1.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '9.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: faraday
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 1.0.0
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '3.0'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 1.0.0
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '3.0'
53
+ - !ruby/object:Gem::Dependency
54
+ name: multi_json
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 1.4.0
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '2.0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 1.4.0
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '2.0'
73
+ description: Ruby client for connecting to Rocket Reach
74
+ email:
75
+ - bapu@nexl.io
76
+ - connor@nexl.cloud
77
+ executables: []
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - ".circleci/config.yml"
82
+ - ".gitignore"
83
+ - ".rspec"
84
+ - ".rubocop.yml"
85
+ - Gemfile
86
+ - LICENSE.txt
87
+ - README.md
88
+ - Rakefile
89
+ - bin/console
90
+ - bin/setup
91
+ - lib/rocket_reach.rb
92
+ - lib/rocket_reach/client.rb
93
+ - lib/rocket_reach/configuration.rb
94
+ - lib/rocket_reach/error.rb
95
+ - lib/rocket_reach/version.rb
96
+ - rocket_reach.gemspec
97
+ homepage: https://github.com/NEXL-LTS/rocket-reach-ruby
98
+ licenses:
99
+ - MIT
100
+ metadata:
101
+ rubygems_mfa_required: 'true'
102
+ rdoc_options: []
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 2.5.0
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ requirements: []
116
+ rubygems_version: 3.6.2
117
+ specification_version: 4
118
+ summary: Ruby client for connecting to Rocket Reach
119
+ test_files: []