scraperapi 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 177a55d48556f0343f77652994e9b13e44d777077c57a7d561ade59e58a32754
4
+ data.tar.gz: 1a48b0d00f94fc58ce887e253252107a8d7db850be45ebc9dad9929e64d004f8
5
+ SHA512:
6
+ metadata.gz: 1d068338b333e3304f5763ff7c586f8a6c3c7f6e534d4cebc2dde68716e1a3cd1b686482efe62bf92554f77663b721b5591ea24af3d7beb1f7cdd18b40dad3c7
7
+ data.tar.gz: 8bcbd91173c3fadca072c8e579e0c23752a8bd777720fb4b480897ff4032e9bae753c2da6aa9e7d568e8b28b9cd693c96dd00b8279280bf2fcd339f70cf6cc57
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4
+ </project>
@@ -0,0 +1,244 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="8c4332c1-c275-4b87-9a66-3655676ba53e" name="Default Changelist" comment="">
5
+ <change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
6
+ <change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
7
+ <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
8
+ <change afterPath="$PROJECT_DIR$/.rspec" afterDir="false" />
9
+ <change afterPath="$PROJECT_DIR$/.travis.yml" afterDir="false" />
10
+ <change afterPath="$PROJECT_DIR$/Gemfile" afterDir="false" />
11
+ <change afterPath="$PROJECT_DIR$/LICENSE.txt" afterDir="false" />
12
+ <change afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
13
+ <change afterPath="$PROJECT_DIR$/Rakefile" afterDir="false" />
14
+ <change afterPath="$PROJECT_DIR$/bin/console" afterDir="false" />
15
+ <change afterPath="$PROJECT_DIR$/bin/setup" afterDir="false" />
16
+ <change afterPath="$PROJECT_DIR$/exe/scraperapi" afterDir="false" />
17
+ <change afterPath="$PROJECT_DIR$/lib/scraper_api.rb" afterDir="false" />
18
+ <change afterPath="$PROJECT_DIR$/lib/scraperapi/version.rb" afterDir="false" />
19
+ <change afterPath="$PROJECT_DIR$/scraperapi.gemspec" afterDir="false" />
20
+ <change afterPath="$PROJECT_DIR$/spec/scraper_api_spec.rb" afterDir="false" />
21
+ <change afterPath="$PROJECT_DIR$/spec/spec_helper.rb" afterDir="false" />
22
+ </list>
23
+ <option name="SHOW_DIALOG" value="false" />
24
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
25
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
26
+ <option name="LAST_RESOLUTION" value="IGNORE" />
27
+ </component>
28
+ <component name="Git.Settings">
29
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
30
+ </component>
31
+ <component name="ProjectId" id="1W5YYYmKZvZVmskCbmvtekmuL0P" />
32
+ <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
33
+ <component name="ProjectViewState">
34
+ <option name="hideEmptyMiddlePackages" value="true" />
35
+ <option name="showExcludedFiles" value="true" />
36
+ <option name="showLibraryContents" value="true" />
37
+ </component>
38
+ <component name="PropertiesComponent">
39
+ <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
40
+ <property name="WebServerToolWindowFactoryState" value="false" />
41
+ <property name="node.js.detected.package.eslint" value="true" />
42
+ <property name="node.js.detected.package.tslint" value="true" />
43
+ <property name="node.js.path.for.package.eslint" value="project" />
44
+ <property name="node.js.path.for.package.tslint" value="project" />
45
+ <property name="node.js.selected.package.eslint" value="(autodetect)" />
46
+ <property name="node.js.selected.package.tslint" value="(autodetect)" />
47
+ <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
48
+ <property name="nodejs_npm_path_reset_for_default_project" value="true" />
49
+ </component>
50
+ <component name="RunManager" selected="RSpec.ScraperAPI can do a post re...">
51
+ <configuration type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true" nameIsGenerated="true">
52
+ <module name="scraperapi" />
53
+ <predefined_log_file enabled="true" id="RUBY_RSPEC" />
54
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
55
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
56
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
57
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
58
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
59
+ <envs>
60
+ <env name="JRUBY_OPTS" value="-X+O" />
61
+ </envs>
62
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
63
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
64
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov">
65
+ <COVERAGE_PATTERN ENABLED="true">
66
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
67
+ </COVERAGE_PATTERN>
68
+ </EXTENSION>
69
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
70
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/scraper_api_spec.rb" />
71
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
72
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
73
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="Scraperapi" />
74
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
75
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
76
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
77
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
78
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
79
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
80
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
81
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
82
+ <method v="2" />
83
+ </configuration>
84
+ <configuration type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true" nameIsGenerated="true">
85
+ <module name="scraperapi" />
86
+ <predefined_log_file enabled="true" id="RUBY_RSPEC" />
87
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
88
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
89
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
90
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
91
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
92
+ <envs>
93
+ <env name="JRUBY_OPTS" value="-X+O" />
94
+ </envs>
95
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
96
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
97
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov">
98
+ <COVERAGE_PATTERN ENABLED="true">
99
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
100
+ </COVERAGE_PATTERN>
101
+ </EXTENSION>
102
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
103
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/scraper_api_spec.rb" />
104
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
105
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
106
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="Scraperapi has a version number" />
107
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
108
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
109
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
110
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
111
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
112
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
113
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
114
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
115
+ <method v="2" />
116
+ </configuration>
117
+ <configuration name="ScraperAPI can do a post re..." type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true" nameIsGenerated="true">
118
+ <module name="scraperapi" />
119
+ <predefined_log_file enabled="true" id="RUBY_RSPEC" />
120
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
121
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
122
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
123
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
124
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
125
+ <envs>
126
+ <env name="JRUBY_OPTS" value="-X+O" />
127
+ </envs>
128
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
129
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
130
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov">
131
+ <COVERAGE_PATTERN ENABLED="true">
132
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
133
+ </COVERAGE_PATTERN>
134
+ </EXTENSION>
135
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
136
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/scraper_api_spec.rb" />
137
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
138
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
139
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="ScraperAPI can do a post request" />
140
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
141
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
142
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
143
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
144
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
145
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
146
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
147
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
148
+ <method v="2" />
149
+ </configuration>
150
+ <configuration name="Scraperapi" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true" nameIsGenerated="true">
151
+ <module name="scraperapi" />
152
+ <predefined_log_file enabled="true" id="RUBY_RSPEC" />
153
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
154
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
155
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
156
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
157
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
158
+ <envs>
159
+ <env name="JRUBY_OPTS" value="-X+O" />
160
+ </envs>
161
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
162
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
163
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov">
164
+ <COVERAGE_PATTERN ENABLED="true">
165
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
166
+ </COVERAGE_PATTERN>
167
+ </EXTENSION>
168
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
169
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/scraperapi_spec.rb" />
170
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
171
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
172
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="Scraperapi" />
173
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
174
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
175
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
176
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
177
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
178
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
179
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
180
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
181
+ <method v="2" />
182
+ </configuration>
183
+ <recent_temporary>
184
+ <list>
185
+ <item itemvalue="RSpec.ScraperAPI can do a post re..." />
186
+ <item itemvalue="RSpec.Scraperapi" />
187
+ </list>
188
+ </recent_temporary>
189
+ </component>
190
+ <component name="ServiceViewManager">
191
+ <option name="viewStates">
192
+ <list>
193
+ <serviceView>
194
+ <treeState>
195
+ <expand />
196
+ <select />
197
+ </treeState>
198
+ </serviceView>
199
+ </list>
200
+ </option>
201
+ </component>
202
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" RAKE_SPRING_PRE_LOADER_OPTION="true" RAILS_SPRING_PRE_LOADER_OPTION="true" />
203
+ <component name="SvnConfiguration">
204
+ <configuration />
205
+ </component>
206
+ <component name="TaskManager">
207
+ <task active="true" id="Default" summary="Default task">
208
+ <changelist id="8c4332c1-c275-4b87-9a66-3655676ba53e" name="Default Changelist" comment="" />
209
+ <created>1578440970015</created>
210
+ <option name="number" value="Default" />
211
+ <option name="presentableId" value="Default" />
212
+ <updated>1578440970015</updated>
213
+ <workItem from="1578440971343" duration="6054000" />
214
+ <workItem from="1579805328445" duration="106000" />
215
+ <workItem from="1579805474675" duration="257000" />
216
+ </task>
217
+ <servers />
218
+ </component>
219
+ <component name="TypeScriptGeneratedFilesManager">
220
+ <option name="version" value="1" />
221
+ </component>
222
+ <component name="WindowStateProjectService">
223
+ <state width="1638" height="280" key="GridCell.Tab.0.bottom" timestamp="1578441002078">
224
+ <screen x="0" y="23" width="1680" height="1027" />
225
+ </state>
226
+ <state width="1638" height="280" key="GridCell.Tab.0.bottom/0.23.1680.1027@0.23.1680.1027" timestamp="1578441002078" />
227
+ <state width="1638" height="280" key="GridCell.Tab.0.center" timestamp="1578441002076">
228
+ <screen x="0" y="23" width="1680" height="1027" />
229
+ </state>
230
+ <state width="1638" height="280" key="GridCell.Tab.0.center/0.23.1680.1027@0.23.1680.1027" timestamp="1578441002076" />
231
+ <state width="1638" height="280" key="GridCell.Tab.0.left" timestamp="1578441002076">
232
+ <screen x="0" y="23" width="1680" height="1027" />
233
+ </state>
234
+ <state width="1638" height="280" key="GridCell.Tab.0.left/0.23.1680.1027@0.23.1680.1027" timestamp="1578441002076" />
235
+ <state width="1638" height="280" key="GridCell.Tab.0.right" timestamp="1578441002077">
236
+ <screen x="0" y="23" width="1680" height="1027" />
237
+ </state>
238
+ <state width="1638" height="280" key="GridCell.Tab.0.right/0.23.1680.1027@0.23.1680.1027" timestamp="1578441002077" />
239
+ <state x="505" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1578489407708">
240
+ <screen x="0" y="23" width="1680" height="1027" />
241
+ </state>
242
+ <state x="505" y="250" width="670" height="676" key="search.everywhere.popup/0.23.1680.1027@0.23.1680.1027" timestamp="1578489407708" />
243
+ </component>
244
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 1.17.2
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in scraperapi.gemspec
6
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Aidan Cunniffe
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.
@@ -0,0 +1,39 @@
1
+ # Scraperapi
2
+
3
+ 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/scraperapi`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'scraperapi'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install scraperapi
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ 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.
30
+
31
+ 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/scraperapi.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -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
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "scraper_api"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -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,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "scraper_api"
@@ -0,0 +1,147 @@
1
+ require "scraperapi/version"
2
+ require 'net/http'
3
+ require 'unirest'
4
+
5
+ module ScraperAPI
6
+ class Client
7
+ def initialize(api_key)
8
+ @api_key = api_key
9
+ end
10
+
11
+ #
12
+ #headers={},
13
+ # country_code=None,
14
+ # premium=None,
15
+ # render=None,
16
+ # session_number=None,
17
+ # autoparse=None,
18
+ # retry=3,
19
+ # timeout=60
20
+
21
+ def get(url,
22
+ headers: {},
23
+ country_code: nil,
24
+ premium: false,
25
+ render: false,
26
+ session_number: nil,
27
+ autoparse: false,
28
+ retry_n: 3,
29
+ timeout: 60)
30
+
31
+
32
+ makeRequestWithMethod(url,
33
+ @api_key,
34
+ "GET",
35
+ headers: headers,
36
+ country_code: country_code,
37
+ premium: premium,
38
+ render: render,
39
+ session_number: session_number,
40
+ autoparse: autoparse,
41
+ retry_n: retry_n,
42
+ timeout: timeout)
43
+
44
+ end
45
+
46
+ def post(url,
47
+ headers: {},
48
+ country_code: nil,
49
+ premium: false,
50
+ render: false,
51
+ session_number: NIL,
52
+ autoparse: false,
53
+ retry_n: 3,
54
+ timeout: 60,
55
+ body: nil)
56
+
57
+ makeRequestWithMethod(url,
58
+ @api_key,
59
+ "POST",
60
+ headers: headers,
61
+ country_code: country_code,
62
+ premium: premium,
63
+ render: render,
64
+ session_number: session_number,
65
+ autoparse: autoparse,
66
+ retry_n: retry_n,
67
+ timeout: timeout,
68
+ body: body)
69
+ end
70
+
71
+ def put(url,
72
+ headers: {},
73
+ country_code: nil,
74
+ premium: false,
75
+ render: false,
76
+ session_number: NIL,
77
+ autoparse: false,
78
+ retry_n: 3,
79
+ timeout: 60,
80
+ body: nil)
81
+
82
+ makeRequestWithMethod(url,
83
+ @api_key,
84
+ "PUT",
85
+ headers: headers,
86
+ country_code: country_code,
87
+ premium: premium,
88
+ render: render,
89
+ session_number: session_number,
90
+ autoparse: autoparse,
91
+ retry_n: retry_n,
92
+ timeout: timeout,
93
+ body: body)
94
+ end
95
+
96
+ def account()
97
+ uri = URI.parse("https://api.scraperapi.com/account")
98
+ uri.query = URI.decode(URI.encode_www_form({:api_key => @api_key}))
99
+ return Unirest.get(uri.to_s).body
100
+ end
101
+
102
+ private
103
+
104
+ def makeRequestWithMethod(url,
105
+ api_key,
106
+ method,
107
+ headers: {},
108
+ country_code: nil,
109
+ premium: false,
110
+ render: false,
111
+ session_number: nil,
112
+ autoparse: false,
113
+ retry_n: 3,
114
+ timeout: 60,
115
+ body: nil)
116
+
117
+
118
+ params = {
119
+ :api_key => api_key,
120
+ :country_code => country_code,
121
+ :premium => premium,
122
+ :render => render,
123
+ :session_number => session_number,
124
+ :autoparse => autoparse,
125
+ :url => url
126
+ }
127
+
128
+ Unirest.timeout(timeout)
129
+
130
+ scraperapi_basepath = "https://api.scraperapi.com/"
131
+ uri = URI.parse(scraperapi_basepath)
132
+ uri.query = URI.decode(URI.encode_www_form(params.compact!))
133
+
134
+ if method == "GET"
135
+ return Unirest.get(uri.to_s, headers:headers)
136
+ end
137
+ if method == "POST"
138
+ return Unirest.post(uri.to_s, headers:headers, parameters: body)
139
+ end
140
+ if method == "PUT"
141
+ return Unirest.put(uri.to_s, headers:headers, parameters: body)
142
+ end
143
+
144
+ end
145
+
146
+ end
147
+ end
@@ -0,0 +1,3 @@
1
+ module ScraperAPI
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,32 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "scraperapi/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "scraperapi"
8
+ spec.version = ScraperAPI::VERSION
9
+ spec.authors = ["Scraper Team"]
10
+ spec.email = ["support@scraperapi.com"]
11
+
12
+ spec.summary = "Proxy API for Web Scraping"
13
+ spec.description = "The Ruby SDK for ScraperAPI"
14
+ spec.homepage = "https://www.scraperapi.com/documentation"
15
+ spec.license = "MIT"
16
+
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.17"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+
31
+ spec.add_runtime_dependency "unirest", "~> 1.1.2"
32
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scraperapi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Scraper Team
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-01-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: unirest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.2
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.1.2
69
+ description: The Ruby SDK for ScraperAPI
70
+ email:
71
+ - support@scraperapi.com
72
+ executables:
73
+ - scraperapi
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".idea/encodings.xml"
79
+ - ".idea/workspace.xml"
80
+ - ".rspec"
81
+ - ".travis.yml"
82
+ - Gemfile
83
+ - LICENSE.txt
84
+ - README.md
85
+ - Rakefile
86
+ - bin/console
87
+ - bin/setup
88
+ - exe/scraperapi
89
+ - lib/scraper_api.rb
90
+ - lib/scraperapi/version.rb
91
+ - scraperapi.gemspec
92
+ homepage: https://www.scraperapi.com/documentation
93
+ licenses:
94
+ - MIT
95
+ metadata: {}
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubygems_version: 3.0.3
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Proxy API for Web Scraping
115
+ test_files: []