Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Using relative paths #2

Merged
merged 1 commit into from
Apr 4, 2015
Merged

Using relative paths #2

merged 1 commit into from
Apr 4, 2015

Conversation

plribeiro3000
Copy link
Member

relates to fog/fog#3430

# section 5.6.3.2 in the ~1000 page pdf spec
def canonicalize_headers(headers)
tmp = headers.reduce({}) {|ret, h| ret[h.first.downcase] = h.last if h.first.match(/^x-tmrk/i) ; ret }
tmp.reject! {|k,v| k == "x-tmrk-authorization" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused block argument - v. If it's necessary, use _ or _v as an argument name to indicate that it won't be used.
Space missing after comma.
Space between { and | missing.

params[:headers].merge!("Accept" => "application/xml")
end
unless params[:body].nil? || params[:body].empty?
params[:headers].merge!({ "x-tmrk-contenthash" => "Sha256 #{Base64.encode64(Digest::SHA2.digest(params[:body].to_s)).chomp}" })

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant curly braces around a hash parameter.

}

ip_address = {
:id => ip_address_id,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.

"x-tmrk-version" => @version,
"Date" => Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S GMT"),
}.merge(params[:headers] || {})
if params[:method]=="POST" || params[:method]=="PUT"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surrounding space missing for operator '=='.

}
environment.merge!(
:Links => {
:Link => [ Fog::Ecloud.keep(organization, :href, :name, :type), ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space inside square brackets detected.


def validate_data(required_opts = [], options = {})
unless required_opts.all? { |opt| options.key?(opt) }
raise ArgumentError.new("Required data missing: #{(required_opts - options.keys).map(&:inspect).join(", ")}")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings inside interpolations.

if params[:uri].is_a?(String)
params[:uri] = URI.parse(@host + params[:uri])
end
host_url = "#{params[:uri].scheme}://#{params[:uri].host}#{params[:uri].port ? ":#{params[:uri].port}" : ""}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings inside interpolations.

@cpu_usage ||= Fog::Compute::Ecloud::CpuUsageDetailSummary.new(:service => service, :href => "#{service.base_path}/computePools/#{id}/usage/cpu")
end

def memory_usage
# time ? query = "/details?time=#{Time.parse(time).utc.strftime('%Y-%m-%dT%H:%M:%SZ')}" : query = ""
# time ? query = "/details?time=#{Time.parse(time).utc.strftime("%Y-%m-%dT%H:%M:%SZ")}" : query = ""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect indentation detected (column 0 instead of 10).

end
slice_ips = slice_ips.map { |i| {:name => i.address.name, :network_name => i.network.name} }.push({:name => options[:ip], :network_name => options[:network_name]}).uniq
slice_ips = slice_ips.map { |i| {:name => i.address.name, :network_name => i.network.name} }.push(:name => options[:ip], :network_name => options[:network_name]).uniq

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space inside { missing.
Space inside } missing.

end

def self.ip_address
4.times.map{ Fog::Mock.random_numbers(3) }.join(".")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space missing to the left of {.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 66.01% when pulling c185122 on fix-loading-time into b39ee0c on master.

plribeiro3000 added a commit that referenced this pull request Apr 4, 2015
@plribeiro3000 plribeiro3000 merged commit 66eac73 into master Apr 4, 2015
@plribeiro3000 plribeiro3000 deleted the fix-loading-time branch April 4, 2015 15:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants