leggy 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d821476efbbb756a5949745fc9d89e5fc2cb8e81
4
+ data.tar.gz: 1efd59068a8971bb13be63aeff08c2f4e7cfbd39
5
+ SHA512:
6
+ metadata.gz: 3ecc733d027635fa516a2db0c0b36fa2fdfd46504440b5dcb7f51a685288958f52707a0efc6785b081c284bd2848fe177380235615f031b8339dc34130b6b4b3
7
+ data.tar.gz: c93468c7b2dc7359a546889a2d0d097c3730a9c7dc93ac46962b4d6665857ee89df71ffbe672f47641caf6bdf8beee9adb885cc302c6362e84f72753a4d9d80c
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ .env
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in leggy.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Matt Solt
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Leggy
2
+
3
+ Ruby wrapper for the 80Legs API. Sign up for a new account at <http://80legs.com/> or view the API docs at <http://datafiniti.github.io/80docs/>.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'leggy'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install leggy
20
+
21
+ ## Usage
22
+
23
+ Please see the spec file for sample usage.
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/activefx/leggy/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/leggy.gemspec ADDED
@@ -0,0 +1,37 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'leggy/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "leggy"
8
+ spec.version = Leggy::VERSION
9
+ spec.authors = ["Matt Solt"]
10
+ spec.email = ["mattsolt@gmail.com"]
11
+ spec.summary = %q{Ruby wrapper for the 80Legs API}
12
+ spec.description = %q{Ruby wrapper for the 80Legs API.}
13
+ spec.homepage = "https://github.com/activefx/leggy"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 3.0"
24
+ spec.add_development_dependency "guard-rspec"
25
+ spec.add_development_dependency "vcr"
26
+ spec.add_development_dependency "webmock"
27
+ spec.add_development_dependency "pry"
28
+
29
+ spec.add_dependency "dotenv", "~> 0.11"
30
+ spec.add_dependency "gem_config", ">= 0.3"
31
+ spec.add_dependency "faraday", "~> 0.9"
32
+ spec.add_dependency "faraday_middleware", "~> 0.9"
33
+ spec.add_dependency "resource_kit", "~> 0.1"
34
+ spec.add_dependency "kartograph", ">= 0.0.8"
35
+ spec.add_dependency "activesupport", "~> 4.0"
36
+
37
+ end
data/lib/leggy.rb ADDED
@@ -0,0 +1,95 @@
1
+ require "leggy/version"
2
+ require "dotenv"
3
+ require "gem_config"
4
+ require "kartograph"
5
+ require "resource_kit"
6
+ require "faraday_middleware"
7
+ require "base64"
8
+ require "active_support/concern"
9
+ require "active_support/core_ext/hash/slice"
10
+ require "ostruct"
11
+
12
+ Dotenv.load
13
+
14
+ module Leggy
15
+ include GemConfig::Base
16
+
17
+ with_configuration do
18
+ has :api_token, classes: String, default: ENV['80_LEGS_API_TOKEN']
19
+ end
20
+
21
+ def self.api_token
22
+ Base64.encode64("#{configuration.api_token}:")
23
+ end
24
+
25
+ def self.connection=(value)
26
+ @connection = value
27
+ end
28
+
29
+ def self.connection
30
+ @connection ||= Faraday.new(
31
+ url: 'https://api.80legs.com',
32
+ headers: {
33
+ content_type: 'application/json',
34
+ authorization: "Basic #{api_token}"
35
+ }
36
+ ) do |req|
37
+ req.adapter :net_http
38
+ end
39
+ end
40
+
41
+ # This resource allows for the viewing of user data.
42
+ #
43
+ def self.users(options = {})
44
+ Leggy::Resource::User.new(setup(options))
45
+ end
46
+
47
+ # This resource allows for the uploading of 80app files.
48
+ #
49
+ def self.apps(options = {})
50
+ Leggy::Resource::App.new(setup(options))
51
+ end
52
+
53
+ # This resource allows for the uploading and viewing of URL lists.
54
+ #
55
+ def self.urls(options = {})
56
+ Leggy::Resource::Url.new(setup(options))
57
+ end
58
+
59
+ # This resource allows for the creation and cancelation of crawls. It also allows
60
+ # the user to view the crawl status and settings. When the crawl is complete the
61
+ # links of the results will also be provided within the crawl.
62
+ #
63
+ def self.crawls(options = {})
64
+ Leggy::Resource::Crawl.new(setup(options))
65
+ end
66
+
67
+ def self.setup(options)
68
+ options[:connection] = connection unless options[:connection]
69
+ options
70
+ end
71
+
72
+ autoload :Helpers, 'leggy/helpers'
73
+ autoload :User, 'leggy/user'
74
+ autoload :App, 'leggy/app'
75
+ autoload :Url, 'leggy/url'
76
+ autoload :CrawlOptions, 'leggy/crawl_options'
77
+ autoload :Crawl, 'leggy/crawl'
78
+
79
+ module Mapping
80
+ autoload :User, 'leggy/mapping/user'
81
+ autoload :App, 'leggy/mapping/app'
82
+ autoload :Url, 'leggy/mapping/url'
83
+ autoload :CrawlOptions, 'leggy/mapping/crawl_options'
84
+ autoload :Crawl, 'leggy/mapping/crawl'
85
+ end
86
+
87
+ module Resource
88
+ autoload :User, 'leggy/resource/user'
89
+ autoload :App, 'leggy/resource/app'
90
+ autoload :Url, 'leggy/resource/url'
91
+ autoload :Crawl, 'leggy/resource/crawl'
92
+ end
93
+
94
+ end
95
+
@@ -0,0 +1,3 @@
1
+ module Leggy
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,249 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: leggy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Matt Solt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-14 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.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
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: guard-rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: vcr
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: dotenv
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.11'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.11'
125
+ - !ruby/object:Gem::Dependency
126
+ name: gem_config
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0.3'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0.3'
139
+ - !ruby/object:Gem::Dependency
140
+ name: faraday
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.9'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.9'
153
+ - !ruby/object:Gem::Dependency
154
+ name: faraday_middleware
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '0.9'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '0.9'
167
+ - !ruby/object:Gem::Dependency
168
+ name: resource_kit
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.1'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.1'
181
+ - !ruby/object:Gem::Dependency
182
+ name: kartograph
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: 0.0.8
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: 0.0.8
195
+ - !ruby/object:Gem::Dependency
196
+ name: activesupport
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '4.0'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '4.0'
209
+ description: Ruby wrapper for the 80Legs API.
210
+ email:
211
+ - mattsolt@gmail.com
212
+ executables: []
213
+ extensions: []
214
+ extra_rdoc_files: []
215
+ files:
216
+ - ".gitignore"
217
+ - Gemfile
218
+ - LICENSE.txt
219
+ - README.md
220
+ - Rakefile
221
+ - leggy.gemspec
222
+ - lib/leggy.rb
223
+ - lib/leggy/version.rb
224
+ homepage: https://github.com/activefx/leggy
225
+ licenses:
226
+ - MIT
227
+ metadata: {}
228
+ post_install_message:
229
+ rdoc_options: []
230
+ require_paths:
231
+ - lib
232
+ required_ruby_version: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ required_rubygems_version: !ruby/object:Gem::Requirement
238
+ requirements:
239
+ - - ">="
240
+ - !ruby/object:Gem::Version
241
+ version: '0'
242
+ requirements: []
243
+ rubyforge_project:
244
+ rubygems_version: 2.2.2
245
+ signing_key:
246
+ specification_version: 4
247
+ summary: Ruby wrapper for the 80Legs API
248
+ test_files: []
249
+ has_rdoc: