diff --git a/lib/remocon/command/lib/request.rb b/lib/remocon/command/lib/request.rb index 81f4b68..52696b5 100644 --- a/lib/remocon/command/lib/request.rb +++ b/lib/remocon/command/lib/request.rb @@ -53,11 +53,19 @@ def self.validate(config, config_temp_file) end def self.pull(config) - raw_json, etag = open(config.endpoint, "Authorization" => "Bearer #{config.token}") do |io| - [io.read, io.meta["etag"]] - end + client, uri = Request.build_client(config) + + headers = { + "Authorization" => "Bearer #{config.token}", + "Content-Type" => "application/json; UTF8", + "Content-Encoding" => "gzip", + } + + request = Net::HTTP::Get.new(uri.request_uri, headers) - [raw_json, etag] + response = client.request(request) + + [response.body, response.header["etag"]] end def self.fetch_etag(config) @@ -68,10 +76,11 @@ def self.fetch_etag(config) headers = { "Authorization" => "Bearer #{config.token}", "Content-Type" => "application/json; UTF8", - "Content-Encoding" => "gzip", + "Content-Encoding" => "gzip" } request = Net::HTTP::Get.new(uri.request_uri, headers) + response = client.request(request) response.kind_of?(Net::HTTPOK) && response.header["etag"] diff --git a/lib/remocon/dumper/parameter_file_dumper.rb b/lib/remocon/dumper/parameter_file_dumper.rb index f86c490..eba8959 100644 --- a/lib/remocon/dumper/parameter_file_dumper.rb +++ b/lib/remocon/dumper/parameter_file_dumper.rb @@ -8,6 +8,8 @@ def initialize(parameters) def dump @parameters.each_with_object({}) do |(key, body), hash| + next unless body[:defaultValue][:value] + hash[key] = body[:defaultValue] hash[key][:description] = body[:description] if body[:description] diff --git a/lib/remocon/version.rb b/lib/remocon/version.rb index 25eb398..48eb48d 100644 --- a/lib/remocon/version.rb +++ b/lib/remocon/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Remocon - VERSION = "0.5.1" + VERSION = "0.5.2" end