Sha256: 956c5a0e0c3ac9475fdf974ea1eadd41d0f08ddbc7fc58d295bf2374f6580386

Contents?: true

Size: 483 Bytes

Versions: 3

Compression:

Stored size: 483 Bytes

Contents

# frozen_string_literal: true

module AppleMusic
  # https://developer.apple.com/documentation/applemusicapi/relationship
  class Relationship
    attr_reader :data, :href, :meta, :next

    def initialize(props = {})
      props ||= {}

      @data = build_list(props['data'])
      @href = props['href']
      @meta = props['meta']
      @next = props['next']
    end

    private

    def build_list(data)
      Array(data).map { |attrs| Resource.build(attrs) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
apple_music-0.3.1 lib/apple_music/relationship.rb
apple_music-0.3.0 lib/apple_music/relationship.rb
apple_music-0.2.0 lib/apple_music/relationship.rb