Module: DomReactorRedGlass

Defined in:
lib/domreactor-redglass.rb,
lib/domreactor-redglass/config.rb,
lib/domreactor-redglass/version.rb,
lib/domreactor-redglass/chain_reaction.rb

Defined Under Namespace

Classes: ChainReaction, Config

Constant Summary collapse

VERSION =
"0.0.7"

Instance Method Summary collapse

Instance Method Details

#auth_tokenObject



14
15
16
# File 'lib/domreactor-redglass.rb', line 14

def auth_token
  Config.auth_token
end

#auth_token=(auth_token) ⇒ Object



10
11
12
# File 'lib/domreactor-redglass.rb', line 10

def auth_token=(auth_token)
  Config.auth_token=auth_token
end

#create_chain_reaction(archive_location, opts) ⇒ Object



18
19
20
21
22
23
# File 'lib/domreactor-redglass.rb', line 18

def create_chain_reaction(archive_location, opts)
  archive_location = ArchiveLocation.new(archive_location, opts)
  archive_location.validate!
  @chain_reaction = ChainReaction.new(opts)
  @chain_reaction.post_archives(archive_location)
end

#parse_json_file(path) ⇒ Object



31
32
33
34
# File 'lib/domreactor-redglass.rb', line 31

def parse_json_file(path)
  json_str = File.open(path, 'rb') {|f| f.read}
  JSON.parse(json_str, symbolize_names: true)
end

#poll_report(opts = {}) ⇒ Object



25
26
27
28
29
# File 'lib/domreactor-redglass.rb', line 25

def poll_report(opts={})
  poller = ReportPoller.new(@chain_reaction, opts)
  poller.poll_completion
  poller.report
end