cloudscrape-client 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f6375b7739448506067f0932c14912302609a4e5
4
+ data.tar.gz: ccc04537a0f4b383a5621e77a0ea4d5fcc0eb993
5
+ SHA512:
6
+ metadata.gz: 5dd4731ecaa4864740d9d52598ab633c6cbc375729f07bc012525b4c6eb637bc3ace2a2e790e912e8e36db68832fadd8c8d9b7c3b4a62bb352f65f4547d5eb5d
7
+ data.tar.gz: 0f99b0ee8a3ea4816998094ab6bd2d120e2d7701390970d152e75eeadf595c280413030b9c5701f55b3b12d36c20d7aab86f1d5ccc1295dd305cd444263b25c5
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,7 @@
1
+ Style/StringLiterals:
2
+ EnforcedStyle: double_quotes
3
+ Style/Documentation:
4
+ Enabled: false
5
+ AllCops:
6
+ Exclude:
7
+ - 'bin/*'
@@ -0,0 +1,13 @@
1
+ SimpleCov.configure do
2
+ start("rails") do
3
+ formatter SimpleCov::Formatter::MultiFormatter[
4
+ SimpleCov::Formatter::HTMLFormatter
5
+ ]
6
+
7
+ add_group "Long files" do |src_file|
8
+ src_file.lines.count > 100
9
+ end
10
+
11
+ add_filter "spec/*"
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
5
+ deploy:
6
+ provider: rubygems
7
+ api_key:
8
+ secure: ccDpQE6KaSKvdi4mv8CvoqF3rxRxRhpzlfs7VpcOfeyk1CGwINyH1H7fUYTcgHYikYaW0SQHSQ2lpIchUVonLQThYatdBuadmgWeNQS0lUJeGv7nmjEwCfqjGQDBmQnr+MBih3UvMUBmQFZUjVFQBhu9PXh8Mzde1P/hPcPHCvFWHCyhLDkezAHi3RIIWm7jQqtk/ogJfg/xCKOVQLJV1LMmR9HMnE3x0cSR+2dBRc19+hSVvwFaQAhVGdITYB8Kz7ayz7kmgPDFW/5fwnpnUiiul/fud+N/++yGg9x9dqXOF2h9axq8mDaa/21IzV7u8B5VYRSPGHH8EpYRJ4dGpNqVGXuUh97OBDCXRx32W9tDXqitbgxOgtfHgCGMnl+2h8tOirv/+y2CqQeoWHIIcPUzT6SFLOP5i76kEwv719skmMriw/yJQKv5ypazUvChx4b04rE32x7pAYmFOLCAcfAEdEMA7pykAoUgq7kFZ9dMmVX+gAYmlTZ4sQPUZiJR14GfnkovZAOCUZ3tPBbkdwrQq9AlW0KH6pZBv3xg5Ln/M28Qz/DS6MYTXV79Cmgq1aq4beE4eXt1CN0Nwfvd2niof/0KewR29wmPOaJNPCXlxTnatX10Badz29LOzGD0cxEdPPut/yUgHze0Fl9h+ZlRBQTJtugVGf89B/l/EH0=
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in cloud_scrape.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Charles J Hardy
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,154 @@
1
+ # CloudScrape Ruby Client [![Build Status](https://travis-ci.org/cloudscrape/cloudscrape-client-ruby.svg?branch=master)](https://travis-ci.org/cloudscrape/cloudscrape-client-ruby)
2
+
3
+ Wrapper for CloudScrape API.
4
+
5
+ * [API Documentation](https://app.cloudscrape.com/#/api)
6
+ * [Support](https://cloudscrape.zendesk.com/hc/en-us)
7
+
8
+
9
+
10
+ ## Requirements
11
+
12
+ * Ruby `> 1.9.x`
13
+
14
+ ## Installation
15
+
16
+ Add this line to your application's Gemfile:
17
+
18
+ gem 'cloud_scrape'
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install cloud_scrape
27
+
28
+ ## Configuration
29
+
30
+ ``` ruby
31
+ CloudScrape.configure do |config|
32
+ config.base_url = "https://app.cloudscrape.com/api/"
33
+ config.api_key = "pol6BFzsASYw4gQBl02b24nt"
34
+ config.account_id = "a814a8r2-a664-4rcb-759c-9de21744117a"
35
+ config.user_agent_app = "MY-AGENT"
36
+ config.user_agent_version = "1.0"
37
+ config.timeout = 60000
38
+ config.verbose = true
39
+ config.logger = Rails.logger
40
+ end
41
+ ```
42
+
43
+ Some configuration can be set by environment variables:
44
+
45
+ ``` bash
46
+ CLOUD_SCRAPE_CLIENT_BASE_URL="https://app.cloudscrape.com/api/"
47
+ CLOUD_SCRAPE_CLIENT_API_KEY="pol6BFzsASYw4gQBl02b24nt"
48
+ CLOUD_SCRAPE_CLIENT_ACCOUNT_ID="a814a8r2-a664-4rcb-759c-9de21744117a"
49
+ CLOUD_SCRAPE_CLIENT_USER_AGENT_APP="MY-AGENT"
50
+ CLOUD_SCRAPE_CLIENT_USER_AGENT_VERSION="1.0"
51
+ CLOUD_SCRAPE_CLIENT_TIMEOUT=60000
52
+ CLOUD_SCRAPE_CLIENT_VERBOSE=true
53
+ ```
54
+
55
+ * `base_url` sets the CloudScrape API url `https://app.cloudscrape.com/api/`
56
+ * `api_key` sets the CloudScrape API Key `nil`
57
+ * `user_agent_app` sets the UserAgent app sent to CloudScrape `CS-RUBY-CLIENT`
58
+ * `user_agent_version` sets the UserAgent version sent to CloudScrape `1.0`
59
+ * `timeout` sets the CloudScrape API request timeout `3600`
60
+ * `verbose` should all output be printed to STDOUT `false`
61
+ * `logger` Logger object. `Logger`
62
+
63
+ ## Usage
64
+
65
+ ``` ruby
66
+ # Create client (optional arguments to override configuration)
67
+ client = CloudScrape.new(
68
+ api_key: "pol6BFzsASYw4gQBl02b24nt",
69
+ account_id: "a814a8r2-a664-4rcb-759c-9de21744117a"
70
+ )
71
+ ```
72
+
73
+ #### Runs (Execute) [Docs](https://app.cloudscrape.com/#/api/sections/runs/execute)
74
+
75
+ ``` ruby
76
+ execution_id = client.runs(run_id).execute
77
+ ```
78
+
79
+ #### Runs (Execute with Input) [Docs](https://app.cloudscrape.com/#/api/sections/runs/executeWithInput)
80
+
81
+ When `connect: true` is passed execution will upload it's result to configured integrations for this run.
82
+
83
+ ``` ruby
84
+ execution_id = client.runs(run_id).execute(input: { url: 'http://google.com' }, connect: true)
85
+ ```
86
+
87
+ #### Executions (Get) [Docs](https://app.cloudscrape.com/#/api/sections/executions/get)
88
+
89
+ ``` ruby
90
+ execution = client.executions(execution_id).get
91
+ execution.queued? # => false
92
+ execution.pending? # => true
93
+ execution.running? # => false
94
+ execution.failed? # => false
95
+ execution.stopped? # => false
96
+ execution.ok? # => false
97
+ ```
98
+
99
+ #### Executions (Remove) [Docs](https://app.cloudscrape.com/#/api/sections/executions/remove)
100
+
101
+ ``` ruby
102
+ client.executions(execution_id).remove
103
+ ```
104
+
105
+ #### Executions (Get Result) [Docs](https://app.cloudscrape.com/#/api/sections/executions/getResult)
106
+
107
+ Methods are dynamically defined based on headers.
108
+
109
+ ``` ruby
110
+ execution = client.executions(execution_id).result
111
+ execution.response # => { headers: [...], rows: [...] }
112
+ execution.as_hash # => { ... }
113
+ ```
114
+
115
+ #### Executions (Stop) [Docs](https://app.cloudscrape.com/#/api/sections/executions/stop)
116
+
117
+ ``` ruby
118
+ client.executions(execution_id).stop
119
+ ```
120
+
121
+ #### Executions (Continue) [Docs](https://app.cloudscrape.com/#/api/sections/executions/continue)
122
+
123
+ ``` ruby
124
+ client.executions(execution_id).continue
125
+ ```
126
+
127
+ ## Postman File
128
+
129
+ [Download](./postman_collection) and add the Postman File for API endpoints.
130
+
131
+ ## Testing
132
+
133
+ Ensure `CLOUD_SCRAPE_CLIENT_API_KEY_OVERRIDE` and `CLOUD_SCRAPE_CLIENT_ACCOUNT_ID_OVERRIDE` environment variable is set when recording VCR cassettes.
134
+
135
+ # Includes Rubocop
136
+ $ bin/test
137
+
138
+ ## Development
139
+
140
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
141
+
142
+ 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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
143
+
144
+ ## Contributing
145
+
146
+ 1. Fork it ( https://github.com/cloudscrape/cloudscrape-client-ruby/fork )
147
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
148
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
149
+ 4. Push to the branch (`git push origin my-new-feature`)
150
+ 5. Create a new Pull Request
151
+
152
+ ## License
153
+
154
+ The gem is available as open source under the terms of the [MIT License](http://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,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'bundler' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('bundler', 'bundler')
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "cloud_scrape"
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
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'htmldiff' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('diff-lcs', 'htmldiff')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'ldiff' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('diff-lcs', 'ldiff')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rake', 'rake')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rspec-core', 'rspec')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rubocop' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rubocop', 'rubocop')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'ruby-parse' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('parser', 'ruby-parse')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'ruby-rewrite' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('parser', 'ruby-rewrite')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'safe_yaml' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('safe_yaml', 'safe_yaml')
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+
3
+ ./bin/rubocop
4
+ ./bin/rspec