Class: SpotifyWebApi::RecommendationSeedObject

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/spotify_web_api/models/recommendation_seed_object.rb

Overview

RecommendationSeedObject Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(after_filtering_size = SKIP, after_relinking_size = SKIP, href = SKIP, id = SKIP, initial_pool_size = SKIP, type = SKIP) ⇒ RecommendationSeedObject

Returns a new instance of RecommendationSeedObject.



69
70
71
72
73
74
75
76
77
78
# File 'lib/spotify_web_api/models/recommendation_seed_object.rb', line 69

def initialize(after_filtering_size = SKIP, after_relinking_size = SKIP,
               href = SKIP, id = SKIP, initial_pool_size = SKIP,
               type = SKIP)
  @after_filtering_size = after_filtering_size unless after_filtering_size == SKIP
  @after_relinking_size = after_relinking_size unless after_relinking_size == SKIP
  @href = href unless href == SKIP
  @id = id unless id == SKIP
  @initial_pool_size = initial_pool_size unless initial_pool_size == SKIP
  @type = type unless type == SKIP
end

Instance Attribute Details

#after_filtering_sizeInteger

The number of tracks available after min_* and max_* filters have been applied.

Returns:

  • (Integer)


15
16
17
# File 'lib/spotify_web_api/models/recommendation_seed_object.rb', line 15

def after_filtering_size
  @after_filtering_size
end

#after_relinking_sizeInteger

The number of tracks available after relinking for regional availability.

Returns:

  • (Integer)


19
20
21
# File 'lib/spotify_web_api/models/recommendation_seed_object.rb', line 19

def after_relinking_size
  @after_relinking_size
end

#hrefString

A link to the full track or artist data for this seed. For tracks this will be a link to a Track Object. For artists a link to an Artist Object. For genre seeds, this value will be ‘null`.

Returns:

  • (String)


25
26
27
# File 'lib/spotify_web_api/models/recommendation_seed_object.rb', line 25

def href
  @href
end

#idString

The id used to select this seed. This will be the same as the string used in the ‘seed_artists`, `seed_tracks` or `seed_genres` parameter.

Returns:

  • (String)


30
31
32
# File 'lib/spotify_web_api/models/recommendation_seed_object.rb', line 30

def id
  @id
end

#initial_pool_sizeInteger

The number of recommended tracks available for this seed.

Returns:

  • (Integer)


34
35
36
# File 'lib/spotify_web_api/models/recommendation_seed_object.rb', line 34

def initial_pool_size
  @initial_pool_size
end

#typeString

The entity type of this seed. One of ‘artist`, `track` or `genre`.

Returns:

  • (String)


38
39
40
# File 'lib/spotify_web_api/models/recommendation_seed_object.rb', line 38

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/spotify_web_api/models/recommendation_seed_object.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  after_filtering_size =
    hash.key?('afterFilteringSize') ? hash['afterFilteringSize'] : SKIP
  after_relinking_size =
    hash.key?('afterRelinkingSize') ? hash['afterRelinkingSize'] : SKIP
  href = hash.key?('href') ? hash['href'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  initial_pool_size =
    hash.key?('initialPoolSize') ? hash['initialPoolSize'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP

  # Create object from extracted values.
  RecommendationSeedObject.new(after_filtering_size,
                               after_relinking_size,
                               href,
                               id,
                               initial_pool_size,
                               type)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
# File 'lib/spotify_web_api/models/recommendation_seed_object.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['after_filtering_size'] = 'afterFilteringSize'
  @_hash['after_relinking_size'] = 'afterRelinkingSize'
  @_hash['href'] = 'href'
  @_hash['id'] = 'id'
  @_hash['initial_pool_size'] = 'initialPoolSize'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



65
66
67
# File 'lib/spotify_web_api/models/recommendation_seed_object.rb', line 65

def self.nullables
  []
end

.optionalsObject

An array for optional fields



53
54
55
56
57
58
59
60
61
62
# File 'lib/spotify_web_api/models/recommendation_seed_object.rb', line 53

def self.optionals
  %w[
    after_filtering_size
    after_relinking_size
    href
    id
    initial_pool_size
    type
  ]
end