Sha256: fbff407a87988826ee2647686e2950e678bfe606f637e3b0397c5d236352001d
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
require 'rest-client' require 'uri' require 'time' module RokuPackager class Packager class PackagingError < StandardError; end def initialize(host, name_and_version, password) @host = host @name_and_version = name_and_version @password = password end def submit if relative_path_match = pull_out_relative_package_path(submission_response) relative_path = relative_path_match[1] else raise PackagingError, submission_response end URI::HTTP.build(host: @host, path: '/' + relative_path) end def submission_response parameters = { passwd: @password, pkg_time: Time.now.to_i, app_name: @name_and_version, mysubmit: 'Package', multipart: true } RestClient.post url.to_s, parameters end def url @url ||= URI::HTTP.build(host: @host, path: '/plugin_package') end private def pull_out_relative_package_path(html_body) /a href="(pkgs\S*)">/.match(html_body) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
roku-packager-0.0.3 | lib/roku-packager/packager.rb |
roku-packager-0.0.1 | lib/roku-packager/packager.rb |