Class: Ccs::Downloader

Inherits:
Object
  • Object
show all
Defined in:
lib/ccs/downloader.rb

Instance Method Summary collapse

Constructor Details

#initialize(uri, access_token, passphrase) ⇒ Downloader

Returns a new instance of Downloader.



5
6
7
8
9
# File 'lib/ccs/downloader.rb', line 5

def initialize(uri, access_token, passphrase)
  @uri = uri
  @access_token = access_token
  @passphrase = passphrase
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
# File 'lib/ccs/downloader.rb', line 11

def call
  response = http.request(request)
  body = response.body
  return unless response.code.eql? '200'
  json = JSON.parse body

  Decrypter.new(@passphrase, json['encrypted_content']).call
end