[ARVADOS] created: 4b79e0e764d79745dc4d9cf2a03c871dbc772027
git at public.curoverse.com
git at public.curoverse.com
Mon Feb 16 11:42:22 EST 2015
at 4b79e0e764d79745dc4d9cf2a03c871dbc772027 (commit)
commit 4b79e0e764d79745dc4d9cf2a03c871dbc772027
Author: Tom Clegg <tom at curoverse.com>
Date: Mon Feb 16 11:26:25 2015 -0500
4759: Use ISO 8601 timestamps with fractional seconds in API responses.
diff --git a/services/api/app/models/api_client_authorization.rb b/services/api/app/models/api_client_authorization.rb
index b9442d6..62e736f 100644
--- a/services/api/app/models/api_client_authorization.rb
+++ b/services/api/app/models/api_client_authorization.rb
@@ -14,8 +14,8 @@ class ApiClientAuthorization < ArvadosModel
t.add :api_token
t.add :created_by_ip_address
t.add :default_owner_uuid
- t.add :expires_at
- t.add :last_used_at
+ t.add lambda { |m| m.expires_at.andand.to_s :api }, as: :expires_at
+ t.add lambda { |m| m.last_used_at.andand.to_s :api }, as: :last_used_at
t.add :last_used_by_ip_address
t.add :scopes
end
diff --git a/services/api/app/models/authorized_key.rb b/services/api/app/models/authorized_key.rb
index b156a1d..dd1e9ea 100644
--- a/services/api/app/models/authorized_key.rb
+++ b/services/api/app/models/authorized_key.rb
@@ -14,7 +14,7 @@ class AuthorizedKey < ArvadosModel
t.add :key_type
t.add :authorized_user_uuid
t.add :public_key
- t.add :expires_at
+ t.add lambda { |m| m.expires_at.andand.to_s :api }, as: :expires_at
end
def permission_to_set_authorized_user_uuid
diff --git a/services/api/app/models/job.rb b/services/api/app/models/job.rb
index 0444528..345f7a5 100644
--- a/services/api/app/models/job.rb
+++ b/services/api/app/models/job.rb
@@ -30,11 +30,11 @@ class Job < ArvadosModel
t.add :script
t.add :script_parameters
t.add :script_version
- t.add :cancelled_at
+ t.add lambda { |m| m.cancelled_at.andand.to_s :api }, as: :cancelled_at
t.add :cancelled_by_client_uuid
t.add :cancelled_by_user_uuid
- t.add :started_at
- t.add :finished_at
+ t.add lambda { |m| m.started_at.andand.to_s :api }, as: :started_at
+ t.add lambda { |m| m.finished_at.andand.to_s :api }, as: :finished_at
t.add :output
t.add :success
t.add :running
diff --git a/services/api/app/models/job_task.rb b/services/api/app/models/job_task.rb
index 5f83fbe..a6fb7e7 100644
--- a/services/api/app/models/job_task.rb
+++ b/services/api/app/models/job_task.rb
@@ -15,8 +15,8 @@ class JobTask < ArvadosModel
t.add :output
t.add :progress
t.add :success
- t.add :started_at
- t.add :finished_at
+ t.add lambda { |m| m.started_at.andand.to_s :api }, as: :started_at
+ t.add lambda { |m| m.finished_at.andand.to_s :api }, as: :finished_at
end
protected
diff --git a/services/api/app/models/keep_disk.rb b/services/api/app/models/keep_disk.rb
index da421eb..9efaf52 100644
--- a/services/api/app/models/keep_disk.rb
+++ b/services/api/app/models/keep_disk.rb
@@ -11,9 +11,9 @@ class KeepDisk < ArvadosModel
t.add :bytes_free
t.add :is_readable
t.add :is_writable
- t.add :last_read_at
- t.add :last_write_at
- t.add :last_ping_at
+ t.add lambda { |m| m.last_read_at.andand.to_s :api }, as: :last_read_at
+ t.add lambda { |m| m.last_write_at.andand.to_s :api }, as: :last_write_at
+ t.add lambda { |m| m.last_ping_at.andand.to_s :api }, as: :last_ping_at
t.add :service_host
t.add :service_port
t.add :service_ssl_flag
diff --git a/services/api/app/models/log.rb b/services/api/app/models/log.rb
index 39f789e..464d362 100644
--- a/services/api/app/models/log.rb
+++ b/services/api/app/models/log.rb
@@ -12,7 +12,7 @@ class Log < ArvadosModel
t.add :object_uuid
t.add :object_owner_uuid
t.add :object_kind
- t.add :event_at
+ t.add lambda { |m| m.event_at.andand.to_s :api }, as: :event_at
t.add :event_type
t.add :summary
t.add :properties
diff --git a/services/api/app/models/node.rb b/services/api/app/models/node.rb
index c38f681..6451992 100644
--- a/services/api/app/models/node.rb
+++ b/services/api/app/models/node.rb
@@ -26,7 +26,7 @@ class Node < ArvadosModel
t.add :hostname
t.add :domain
t.add :ip_address
- t.add :last_ping_at
+ t.add lambda { |m| m.last_ping_at.andand.to_s :api }, as: :last_ping_at
t.add :slot_number
t.add :status
t.add :api_job_uuid, as: :job_uuid
@@ -34,7 +34,7 @@ class Node < ArvadosModel
t.add :properties
end
api_accessible :superuser, :extend => :user do |t|
- t.add :first_ping_at
+ t.add lambda { |m| m.first_ping_at.andand.to_s :api }, as: :first_ping_at
t.add :info
t.add lambda { |x| @@nameservers }, :as => :nameservers
end
diff --git a/services/api/app/models/pipeline_instance.rb b/services/api/app/models/pipeline_instance.rb
index 28345d5..2cd36ee 100644
--- a/services/api/app/models/pipeline_instance.rb
+++ b/services/api/app/models/pipeline_instance.rb
@@ -23,8 +23,8 @@ class PipelineInstance < ArvadosModel
t.add :state
t.add :components_summary
t.add :description
- t.add :started_at
- t.add :finished_at
+ t.add lambda { |m| m.started_at.andand.to_s :api }, as: :started_at
+ t.add lambda { |m| m.finished_at.andand.to_s :api }, as: :finished_at
end
# Supported states for a pipeline instance
diff --git a/services/api/lib/common_api_template.rb b/services/api/lib/common_api_template.rb
index 67c7f8c..6f7e0ef 100644
--- a/services/api/lib/common_api_template.rb
+++ b/services/api/lib/common_api_template.rb
@@ -1,4 +1,6 @@
module CommonApiTemplate
+ Time::DATE_FORMATS[:api] = lambda { |t| t.strftime "%Y-%m-%dT%H:%M:%S.%NZ" }
+
def self.included(base)
base.acts_as_api
base.class_eval do
@@ -12,10 +14,10 @@ module CommonApiTemplate
t.add :etag
t.add :uuid
t.add :owner_uuid
- t.add :created_at
+ t.add lambda { |m| m.created_at.andand.to_s :api }, as: :created_at
t.add :modified_by_client_uuid
t.add :modified_by_user_uuid
- t.add :modified_at
+ t.add lambda { |m| m.modified_at.andand.to_s :api }, as: :modified_at
end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list