Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions lib/remocon/command/lib/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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"]
Expand Down
2 changes: 2 additions & 0 deletions lib/remocon/dumper/parameter_file_dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
2 changes: 1 addition & 1 deletion lib/remocon/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Remocon
VERSION = "0.5.1"
VERSION = "0.5.2"
end