-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds LastModifed to object as last_modifed #47
adds LastModifed to object as last_modifed #47
Conversation
S3 and DigitalOcean spaces both seem to use ISO string where the date and time are separated by a I could parse the times so |
Thanks! I think parsing it as a |
spec/awscr-s3/client_spec.cr
Outdated
Object.new("key2", 1337, | ||
"\"fba9dede5f27731c9771645a39863329\""), | ||
"\"fba9dede5f27731c9771645a39863329\"", "2009-10-12T17:50:30.000Z"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's slightly confusing both of these have the same last_modifed, despite being different in the xml response. Took me a while to figure out why the tests passed until I remembered how the Object equality was implemented. I wonder if last_modified
should be added to the def_equals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh awesome i didn't know def_equals was a thing. I'll replace that helper i added with this
spec/awscr-s3/object_spec.cr
Outdated
object.etag.should eq("etag") | ||
end | ||
it "has etag" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a space, above it
(or just run crystal tool format
) and test description is repeated :).
I tried to use the existing Time Format string you showed me above but the time returned by DigitalOcean uses a decimal precision (e.g. Example: # "%Y-%M-%dT%H:%M:%S" is the same as "%FT%T"
last_modified = Time.parse(object.string("LastModified"), "%FT%T", Time::Location::UTC) (When you don't specify a timezone in the time format string it required a location) |
It looks like if a timestamp format is not specified the Ruby gem parses UTC and iso 8601. So I guess let's do that |
exposes the LastModifed time string to the user
example: