Class: BOTR::Player

Inherits:
Object show all
Defined in:
lib/botr/players/player.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Authentication

#signature

Methods included from API

#api_call_class, #api_format, #api_key, #api_nonce, #api_protocol, #api_secret_key, #api_server, #api_timestamp, #api_url, #api_version, #progress_url, #upload_address, #upload_key, #upload_protocol, #upload_token, #upload_url

Methods included from HTTP

#client, #delete_request, #get_request, #post_request, #put_request

Constructor Details

#initialize(params = {}) ⇒ Player

Returns a new instance of Player.



69
70
71
72
73
74
75
# File 'lib/botr/players/player.rb', line 69

def initialize(params = {})
	params.each do |key, val|
		param = "@#{key.to_s}"
		next unless methods.include? key.to_sym
		instance_variable_set(param, val)
	end		
end

Class Attribute Details

.last_statusObject (readonly)

Returns the value of attribute last_status.



7
8
9
# File 'lib/botr/players/player.rb', line 7

def last_status
  @last_status
end

Instance Attribute Details

#advertisingObject (readonly)

Returns the value of attribute advertising.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def advertising
  @advertising
end

#aspectratioObject (readonly)

Returns the value of attribute aspectratio.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def aspectratio
  @aspectratio
end

#autostartObject (readonly)

Returns the value of attribute autostart.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def autostart
  @autostart
end

#captionsObject (readonly)

Returns the value of attribute captions.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def captions
  @captions
end

#controlbarObject (readonly)

Returns the value of attribute controlbar.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def controlbar
  @controlbar
end

#ga_web_property_idObject (readonly)

Returns the value of attribute ga_web_property_id.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def ga_web_property_id
  @ga_web_property_id
end

#heightObject (readonly)

Returns the value of attribute height.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def height
  @height
end

#keyObject (readonly)

Returns the value of attribute key.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def key
  @key
end

#last_statusObject (readonly)

Returns the value of attribute last_status.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def last_status
  @last_status
end

#ltas_channelObject (readonly)

Returns the value of attribute ltas_channel.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def ltas_channel
  @ltas_channel
end

#nameObject (readonly)

Returns the value of attribute name.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def name
  @name
end

#playlistObject (readonly)

Returns the value of attribute playlist.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def playlist
  @playlist
end

#playlistsizeObject (readonly)

Returns the value of attribute playlistsize.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def playlistsize
  @playlistsize
end

Returns the value of attribute related_videos.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def related_videos
  @related_videos
end

#repeatObject (readonly)

Returns the value of attribute repeat.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def repeat
  @repeat
end

#responsiveObject (readonly)

Returns the value of attribute responsive.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def responsive
  @responsive
end

#sharingObject (readonly)

Returns the value of attribute sharing.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def sharing
  @sharing
end

#sharing_player_keyObject (readonly)

Returns the value of attribute sharing_player_key.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def sharing_player_key
  @sharing_player_key
end

#sitecatalystObject (readonly)

Returns the value of attribute sitecatalyst.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def sitecatalyst
  @sitecatalyst
end

#skinObject (readonly)

Returns the value of attribute skin.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def skin
  @skin
end

#stretchingObject (readonly)

Returns the value of attribute stretching.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def stretching
  @stretching
end

#templateObject (readonly)

Returns the value of attribute template.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def template
  @template
end

#versionObject (readonly)

Returns the value of attribute version.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def version
  @version
end

#viewsObject (readonly)

Returns the value of attribute views.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def views
  @views
end

#watermarkObject (readonly)

Returns the value of attribute watermark.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def watermark
  @watermark
end

#widthObject (readonly)

Returns the value of attribute width.



62
63
64
# File 'lib/botr/players/player.rb', line 62

def width
  @width
end

Class Method Details

.allObject



38
39
40
# File 'lib/botr/players/player.rb', line 38

def all
	list({})
end

.list(**options) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/botr/players/player.rb', line 25

def list(**options)
	json = get_request(options.merge(:method => 'list'))
	res = JSON.parse(json.body)
	
	if json.status == 200
		results = process_list_response(res)
	else
		raise "HTTP Error #{json.status}: #{json.body}"
	end

	return results
end

.show(key) ⇒ Object Also known as: find



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/botr/players/player.rb', line 9

def show(key)
	json = get_request({:method => 'show',
					    :player_key => key})
	res = JSON.parse(json.body)

	if json.status == 200
		params = process_show_response(res)
	else
		raise "HTTP Error #{json.status}: #{json.body}"
	end

	return new(params)
end

Instance Method Details

#create(name, sharing_player_key, **options) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/botr/players/player.rb', line 77

def create(name, sharing_player_key, **options)
	json = get_request(options.merge(:method => 'create',
									 :name => name,
									 :sharing_player_key => sharing_player_key))
	res = JSON.parse(json.body)

	if json.status == 200
		process_create_response(res, options)
	else
		raise "HTTP Error #{json.status}: #{json.body}"
	end

	return self
end

#deleteObject



106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/botr/players/player.rb', line 106

def delete
	json = delete_request({:player_key => @key})
	res = JSON.parse(json.body)

	if json.status == 200
		process_delete_response(res)
	else
		raise "HTTP Error #{json.status}: #{json.body}"
	end

	return self
end

#update(**options) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/botr/players/player.rb', line 92

def update(**options)
	json = put_request(options.merge(:player_key => @key,
									 :sharing_player_key => @sharing_player_key))
	res = JSON.parse(json.body)

	if json.status == 200
		process_update_response(res, options)
	else
		raise "HTTP Error #{json.status}: #{json.body}"
	end

	return self
end