Created
April 25, 2019 14:40
-
-
Save ashikajith/d1f06793956e6d4f38cdb15fb69aa632 to your computer and use it in GitHub Desktop.
Revisions
-
ashikajith renamed this gist
Apr 25, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ashikajith created this gist
Apr 25, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ module Ubiquity class ImporterClient include HTTParty format :json base_uri 'https://importer.repo-test.ubiquity.press' attr_accessor :file_url_hash, :code, :file_name_hash def initialize(response) if response @file_name_hash = Hash[response['works'].map { |ele| [ele['uuid'], ele['name']] }] @file_url_hash = Hash[response['works'].map { |ele| [ele['uuid'], ele['providers']['S3Storage']['link']] }] else @file_name_hash = {} @file_url_hash = {} end end def self.get_s3_url(uuid) response = get("/api/entry/#{uuid}", base_uri: base_uri) if response.success? new(response) else new(nil) end end end end