Class: Jamf::TimeZone
- Inherits:
-
CollectionResource
- Object
- JSONObject
- Resource
- CollectionResource
- Jamf::TimeZone
- Extended by:
- Immutable, UnCreatable, UnDeletable
- Defined in:
- lib/jamf/api/resources/collection_resources/time_zone.rb
Overview
A building defined in the JSS
Constant Summary collapse
- RSRC_VERSION =
Constants
'v1'.freeze
- RSRC_PATH =
'time-zones'.freeze
- OBJECT_MODEL =
Object Model / Attributes See APIObject class documentation for details of how the OBJECT_MODEL hash works.
{ # @!attribute [r] zoneId # @return [String] zoneId: { class: :string, identifier: :primary, aliases: [:id] }, # @!attribute displayName # @return [String] displayName: { class: :string, identifier: true, aliases: [:name] }, # @!attribute [r] region # @return [String] region: { class: :string } }.freeze
Instance Attribute Summary collapse
- #region ⇒ String readonly
Class Method Summary collapse
- .creatable? ⇒ Boolean extended from UnCreatable
- .deletable? ⇒ Boolean extended from UnDeletable
- .mutable? ⇒ Boolean extended from Immutable
Instance Method Summary collapse
-
#localtime(othertime) ⇒ Time
Give a Time object, whats the matching local time in this TimeZone?.
-
#utc_offset ⇒ Integer
The offset from UTC, in seconds.
-
#utc_offset_str ⇒ Integer
The offset from UTC, as a string.
Constructor Details
This class inherits a constructor from Jamf::JSONObject
Instance Attribute Details
#region ⇒ String (readonly)
|
|
# File 'lib/jamf/api/resources/collection_resources/time_zone.rb', line 71
|
Class Method Details
.creatable? ⇒ Boolean Originally defined in module UnCreatable
.deletable? ⇒ Boolean Originally defined in module UnDeletable
.mutable? ⇒ Boolean Originally defined in module Immutable
Instance Method Details
#localtime(othertime) ⇒ Time
Give a Time object, whats the matching local time in this TimeZone?
113 114 115 |
# File 'lib/jamf/api/resources/collection_resources/time_zone.rb', line 113 def localtime(othertime) othertime.getlocal utc_offset end |
#utc_offset ⇒ Integer
Returns The offset from UTC, in seconds.
97 98 99 100 101 102 103 104 105 |
# File 'lib/jamf/api/resources/collection_resources/time_zone.rb', line 97 def utc_offset return @utc_offset if @utc_offset sign = utc_offset_str[0] secs = utc_offset_str[1..2].to_i * 3600 secs += utc_offset_str[3..4].to_i * 60 # negate if needed @utc_offset = sign == '+' ? secs : -secs end |
#utc_offset_str ⇒ Integer
The offset from UTC, as a string.
This is as it would appear at the end of an ISO8601 formatted time, e.g. -0945 or +1200
Note that ISO8601 accepts the formats: /-hh:mm, /-hhmm, or +/-hh
88 89 90 91 92 93 |
# File 'lib/jamf/api/resources/collection_resources/time_zone.rb', line 88 def utc_offset_str return @utc_offset_str if @utc_offset_str displayName =~ /\(([+-]\d{4})\)/ @utc_offset_str = Regexp.last_match[1] end |