diff options
Diffstat (limited to 'app/services')
| -rw-r--r-- | app/services/file_service.rb | 35 | ||||
| -rw-r--r-- | app/services/http_service.rb | 11 |
2 files changed, 25 insertions, 21 deletions
diff --git a/app/services/file_service.rb b/app/services/file_service.rb index efccbe24f..3b3ff3561 100644 --- a/app/services/file_service.rb +++ b/app/services/file_service.rb @@ -1,23 +1,24 @@ -module FileService extend self +# TODO: Delete me after stable implementation of #1726 +# module FileService extend self - def unique_filename( path, enum_with: with_ints ) - file_names = enum_with.map( &file_name_maker(path) ) - file_names - .drop_while( &File.method(:exists?) ) - .next - end +# def unique_filename( path, enum_with: with_ints ) +# file_names = enum_with.map( &file_name_maker(path) ) +# file_names +# .drop_while( &File.method(:exists?) ) +# .next +# end - def with_ints(format='%d') - (0..Float::INFINITY) - .lazy - .map{ |n| format % n } - end +# def with_ints(format='%d') +# (0..Float::INFINITY) +# .lazy +# .map{ |n| format % n } +# end - private +# private - def file_name_maker path - ->(n){ [path, n].join('_') } - end +# def file_name_maker path +# ->(n){ [path, n].join('_') } +# end -end +# end diff --git a/app/services/http_service.rb b/app/services/http_service.rb index a3c4d2569..37f1621d5 100644 --- a/app/services/http_service.rb +++ b/app/services/http_service.rb @@ -1,7 +1,4 @@ -class HTTPService - def self.get_resource(*args) - new.get_resource(*args) - end +module HTTPService extend self def get_resource(host:, path:, token: nil, params: {}, parse_json: false) Faraday.new(url: host) do |c| @@ -17,6 +14,12 @@ class HTTPService end end + # host: 'http://localhost:3000', + # path: '/api/v1/netex_imports.json', + # resource_name: 'netex_import', + # token: '13-74009c36638f587c9eafb1ce46e95585', + # params: {referential_id: 13, workbench_id: 1}, + # upload: {file: [StringIO.new('howdy'), 'application/zip', 'greeting']}) def post_resource(host:, path:, resource_name:, token: nil, params: {}, upload: nil) Faraday.new(url: host) do |c| c.headers['Authorization'] = "Token token=#{token.inspect}" if token |
