Module: Leggy

Includes:
GemConfig::Base
Defined in:
lib/leggy.rb,
lib/leggy/app.rb,
lib/leggy/url.rb,
lib/leggy/user.rb,
lib/leggy/crawl.rb,
lib/leggy/error.rb,
lib/leggy/helpers.rb,
lib/leggy/version.rb,
lib/leggy/exceptions.rb,
lib/leggy/mapping/app.rb,
lib/leggy/mapping/url.rb,
lib/leggy/mapping/user.rb,
lib/leggy/resource/app.rb,
lib/leggy/resource/url.rb,
lib/leggy/crawl_options.rb,
lib/leggy/error_handler.rb,
lib/leggy/mapping/crawl.rb,
lib/leggy/resource/user.rb,
lib/leggy/resource/crawl.rb,
lib/leggy/resource/result.rb,
lib/leggy/mapping/crawl_options.rb

Defined Under Namespace

Modules: ErrorHandler, Exception, Helpers, Mapping, Resource Classes: App, Crawl, CrawlOptions, Error, Url, User

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.api_tokenObject



37
38
39
# File 'lib/leggy.rb', line 37

def self.api_token
  Base64.encode64("#{configuration.api_token}:")
end

.apps(options = {}) ⇒ Object

This resource allows for the uploading of 80app files.



65
66
67
# File 'lib/leggy.rb', line 65

def self.apps(options = {})
  Leggy::Resource::App.new(setup(options))
end

.connectionObject



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/leggy.rb', line 45

def self.connection
  Faraday.new(
    url: 'https://api.80legs.com',
    headers: {
      content_type: 'application/json',
      authorization: "Basic #{api_token}"
    }
  ) do |req|
    req.adapter :net_http
  end
end

.connection=(value) ⇒ Object



41
42
43
# File 'lib/leggy.rb', line 41

def self.connection=(value)
  @connection = value
end

.crawls(options = {}) ⇒ Object

This resource allows for the creation and cancelation of crawls. It also allows the user to view the crawl status and settings.



78
79
80
# File 'lib/leggy.rb', line 78

def self.crawls(options = {})
  Leggy::Resource::Crawl.new(setup(options))
end

.results(options = {}) ⇒ Object

This resource allows for viewing a list of the urls containing the crawl results.



85
86
87
# File 'lib/leggy.rb', line 85

def self.results(options = {})
  Leggy::Resource::Result.new(setup(options))
end

.setup(options) ⇒ Object



89
90
91
92
# File 'lib/leggy.rb', line 89

def self.setup(options)
  options[:connection] = connection unless options[:connection]
  options
end

.urls(options = {}) ⇒ Object

This resource allows for the uploading and viewing of URL lists.



71
72
73
# File 'lib/leggy.rb', line 71

def self.urls(options = {})
  Leggy::Resource::Url.new(setup(options))
end

.users(options = {}) ⇒ Object

This resource allows for the viewing of user data.



59
60
61
# File 'lib/leggy.rb', line 59

def self.users(options = {})
  Leggy::Resource::User.new(setup(options))
end