Class: Ccs::Downloader

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

Instance Method Summary collapse

Constructor Details

#initialize(uri, access_token, secret_token) ⇒ Downloader

Returns a new instance of Downloader.



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

def initialize(uri, access_token, secret_token)
  @uri = uri
  @access_token = access_token
  @secret_token = secret_token
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(@secret_token, json['encrypted_content']).call
end