Class: WCC::Media::Client

Inherits:
API::RestClient
  • Object
show all
Defined in:
lib/wcc/media/client.rb,
lib/wcc/media/client/response.rb

Defined Under Namespace

Classes: Resource, Response

Constant Summary collapse

PARAMS =
%w[
  limit
  offset
  order_by
  sort
  target
].freeze
CONFIGURABLE_PARAMS =
PARAMS - %w[
  offset
]
RESOURCES =
{
  'messages' => WCC::Media::Message,
  'series' => WCC::Media::Series,
  'speakers' => WCC::Media::Speaker,
  'tags' => WCC::Media::Tag,
  'playlists' => WCC::Media::Playlist
}.freeze

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ Client

Returns a new instance of Client.



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/wcc/media/client.rb', line 44

def initialize(**options)
  options = {
    api_url: 'https://media.watermark.org/api/v1/',
    response_class: Response
  }.merge!(options)
  super(**options)

  RESOURCES.each do |(endpoint, model)|
    instance_variable_set("@#{endpoint}", Resource.new(self, model, @options))
  end
end

Class Attribute Details

.defaultObject

The default client. Set this in an initializer to change the client used by all the WCC::Media models



16
17
18
# File 'lib/wcc/media/client.rb', line 16

def default
  @default ||= new
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



42
43
44
# File 'lib/wcc/media/client.rb', line 42

def options
  @options
end