Skip to content

Commit

Permalink
Merge pull request #37 from taylorfinnell/changes-for-crystal-0.27.0
Browse files Browse the repository at this point in the history
Updates for Crystal 0.27.0
  • Loading branch information
taylorfinnell authored Nov 6, 2018
2 parents af72437 + a0ce3be commit e9e8c8b
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: awscr-signer
version: 0.5.2
crystal: 0.25.0
version: 0.5.3
crystal: 0.27.0

authors:
- Taylor Finnell <[email protected]>
Expand Down
16 changes: 8 additions & 8 deletions spec/awscr-signer/core/date_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,56 @@ module Awscr
module Signer
describe Date do
it "has a timestamp" do
time = Time.epoch(1440938160)
time = Time.unix(1440938160)
date = Date.new(time)

date.timestamp.should eq time
end

it "can be represented as YMD" do
time = Time.epoch(1440938160)
time = Time.unix(1440938160)
date = Date.new(time)

date.ymd.should eq "20150830"
end

it "can be represented as ISO8601 basic" do
time = Time.epoch(1440938160)
time = Time.unix(1440938160)
date = Date.new(time)

date.iso8601.should eq "20150830T123600Z"
end

it "can be RFC1123Z" do
time = Time.epoch(1440938160)
time = Time.unix(1440938160)
date = Date.new(time)

date.rfc1123z.should eq "Sun, 30 Aug 2015 12:36:00 +0000"
end

it "can be a string" do
time = Time.epoch(1440938160)
time = Time.unix(1440938160)
date = Date.new(time)

date.to_s.should eq "2015-08-30 12:36:00 UTC"
end

it "can be a formatted string" do
time = Time.epoch(1440938160)
time = Time.unix(1440938160)
date = Date.new(time)

date.to_s("%Y").should eq "2015"
end

it "can be compared to Time" do
time = Time.epoch(1440938160)
time = Time.unix(1440938160)
date = Date.new(time)

date.should eq(time)
end

it "can be compared to a Date object" do
time = Time.epoch(1440938160)
time = Time.unix(1440938160)
date = Date.new(time)

date.should eq(Date.new(time))
Expand Down
2 changes: 1 addition & 1 deletion spec/awscr-signer/core/scope_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module Awscr
end

it "can be represented as a string" do
time = Time.epoch(1440938160)
time = Time.unix(1440938160)
scope = Scope.new("region", "service", time)

scope.to_s.should eq "20150830/region/service/aws4_request"
Expand Down
2 changes: 1 addition & 1 deletion spec/awscr-signer/signers/v4_amazon_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Awscr
describe V4 do
describe "signing an HTTP::Request" do
Spec.before_each do
Timecop.freeze(Time.epoch(1440938160))
Timecop.freeze(Time.unix(1440938160))
end

Spec.after_each do
Expand Down
4 changes: 2 additions & 2 deletions spec/awscr-signer/v4/signature_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Awscr
module Signer::V4
describe Signature do
it "can support from a string" do
time = Time.epoch(1375747200)
time = Time.unix(1375747200)
key = "AKIAIOSFODNN7EXAMPLE"
secret = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
region = "us-east-1"
Expand All @@ -19,7 +19,7 @@ module Awscr
end

it "can be a string" do
time = Time.epoch(1440938160)
time = Time.unix(1440938160)
key = "AKIDEXAMPLE"
secret = "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY"
region = "us-east-1"
Expand Down
2 changes: 1 addition & 1 deletion src/awscr-signer/signers/v2.cr
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module Awscr
def presign(request, expires = nil)
scope = Signer::Scope.new(@region, @service)

expires ||= Time.utc_now.epoch + 86_400
expires ||= Time.utc_now.to_unix + 86_400

canonical_request = Signer::V2::Request.new(request.method,
URI.parse(request.path), request.body)
Expand Down
2 changes: 1 addition & 1 deletion src/awscr-signer/version.cr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Awscr
MAJOR = "0"
MINOR = "5"
PATCH = "2"
PATCH = "3"

VERSION = [MAJOR, MINOR, PATCH].join(".")
end

0 comments on commit e9e8c8b

Please sign in to comment.