Skip to content

Commit

Permalink
Add the list of available rails timezones to the base endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed Dec 4, 2020
1 parent d550a30 commit e851c4d
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions app/controllers/api/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ def options

def index
res = {
:name => ApiConfig.base.name,
:description => ApiConfig.base.description,
:version => ManageIQ::Api::VERSION,
:versions => entrypoint_versions,
:settings => user_settings,
:identity => auth_identity,
:server_info => server_info,
:product_info => product_info_data
:name => ApiConfig.base.name,
:description => ApiConfig.base.description,
:version => ManageIQ::Api::VERSION,
:versions => entrypoint_versions,
:settings => user_settings,
:identity => auth_identity,
:server_info => server_info,
:timezones => timezone_list,
:product_info => product_info_data
}
res[:authorization] = auth_authorization if attribute_selection.include?("authorization")
res[:collections] = entrypoint_collections
Expand Down Expand Up @@ -175,5 +176,14 @@ def api_action_details(collection, method, action)
"href" => "#{@req.api_prefix}/#{collection}"
}
end

def timezone_list
ActiveSupport::TimeZone.all.map do |tz|
{
:name => tz.name,
:description => "(GMT#{tz.formatted_offset}) #{tz.name}",
}
end
end
end
end

0 comments on commit e851c4d

Please sign in to comment.