Class: SpotifyWebApi::TimeIntervalObject
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SpotifyWebApi::TimeIntervalObject
- Defined in:
- lib/spotify_web_api/models/time_interval_object.rb
Overview
TimeIntervalObject Model.
Instance Attribute Summary collapse
-
#confidence ⇒ Float
The confidence, from 0.0 to 1.0, of the reliability of the interval.
-
#duration ⇒ Float
The duration (in seconds) of the time interval.
-
#start ⇒ Float
The starting point (in seconds) of the time interval.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(start = SKIP, duration = SKIP, confidence = SKIP) ⇒ TimeIntervalObject
constructor
A new instance of TimeIntervalObject.
Methods inherited from BaseModel
Constructor Details
#initialize(start = SKIP, duration = SKIP, confidence = SKIP) ⇒ TimeIntervalObject
Returns a new instance of TimeIntervalObject.
47 48 49 50 51 |
# File 'lib/spotify_web_api/models/time_interval_object.rb', line 47 def initialize(start = SKIP, duration = SKIP, confidence = SKIP) @start = start unless start == SKIP @duration = duration unless duration == SKIP @confidence = confidence unless confidence == SKIP end |
Instance Attribute Details
#confidence ⇒ Float
The confidence, from 0.0 to 1.0, of the reliability of the interval.
22 23 24 |
# File 'lib/spotify_web_api/models/time_interval_object.rb', line 22 def confidence @confidence end |
#duration ⇒ Float
The duration (in seconds) of the time interval.
18 19 20 |
# File 'lib/spotify_web_api/models/time_interval_object.rb', line 18 def duration @duration end |
#start ⇒ Float
The starting point (in seconds) of the time interval.
14 15 16 |
# File 'lib/spotify_web_api/models/time_interval_object.rb', line 14 def start @start end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/spotify_web_api/models/time_interval_object.rb', line 54 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. start = hash.key?('start') ? hash['start'] : SKIP duration = hash.key?('duration') ? hash['duration'] : SKIP confidence = hash.key?('confidence') ? hash['confidence'] : SKIP # Create object from extracted values. TimeIntervalObject.new(start, duration, confidence) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/spotify_web_api/models/time_interval_object.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['start'] = 'start' @_hash['duration'] = 'duration' @_hash['confidence'] = 'confidence' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/spotify_web_api/models/time_interval_object.rb', line 43 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 40 |
# File 'lib/spotify_web_api/models/time_interval_object.rb', line 34 def self.optionals %w[ start duration confidence ] end |