Class: KhanAcademy::Topic

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/rubykhan.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Topic

Returns a new instance of Topic.



21
22
23
24
25
26
27
# File 'lib/rubykhan.rb', line 21

def initialize(options)
	options.each do |key, value|
		unless key.to_s.empty?
			eval("@#{key}=#{value.inspect}")
		end
	end
end

Instance Attribute Details

#assessment_progress_keyObject (readonly)

Returns the value of attribute assessment_progress_key.



19
20
21
# File 'lib/rubykhan.rb', line 19

def assessment_progress_key
  @assessment_progress_key
end

#background_image_captionObject (readonly)

Returns the value of attribute background_image_caption.



19
20
21
# File 'lib/rubykhan.rb', line 19

def background_image_caption
  @background_image_caption
end

#background_image_urlObject (readonly)

Returns the value of attribute background_image_url.



19
20
21
# File 'lib/rubykhan.rb', line 19

def background_image_url
  @background_image_url
end

#backup_timestampObject (readonly)

Returns the value of attribute backup_timestamp.



19
20
21
# File 'lib/rubykhan.rb', line 19

def backup_timestamp
  @backup_timestamp
end

#child_dataObject (readonly)

Returns the value of attribute child_data.



19
20
21
# File 'lib/rubykhan.rb', line 19

def child_data
  @child_data
end

#childrenObject (readonly)

Returns the value of attribute children.



19
20
21
# File 'lib/rubykhan.rb', line 19

def children
  @children
end

#content_kindObject (readonly)

Returns the value of attribute content_kind.



19
20
21
# File 'lib/rubykhan.rb', line 19

def content_kind
  @content_kind
end

#current_revision_keyObject (readonly)

Returns the value of attribute current_revision_key.



19
20
21
# File 'lib/rubykhan.rb', line 19

def current_revision_key
  @current_revision_key
end

#deletedObject (readonly)

Returns the value of attribute deleted.



19
20
21
# File 'lib/rubykhan.rb', line 19

def deleted
  @deleted
end

#deleted_mod_timeObject (readonly)

Returns the value of attribute deleted_mod_time.



19
20
21
# File 'lib/rubykhan.rb', line 19

def deleted_mod_time
  @deleted_mod_time
end

#descriptionObject (readonly)

Returns the value of attribute description.



19
20
21
# File 'lib/rubykhan.rb', line 19

def description
  @description
end

#domain_slugObject (readonly)

Returns the value of attribute domain_slug.



19
20
21
# File 'lib/rubykhan.rb', line 19

def domain_slug
  @domain_slug
end

#extended_slugObject (readonly)

Returns the value of attribute extended_slug.



19
20
21
# File 'lib/rubykhan.rb', line 19

def extended_slug
  @extended_slug
end

#facebook_urlObject (readonly)

Returns the value of attribute facebook_url.



19
20
21
# File 'lib/rubykhan.rb', line 19

def facebook_url
  @facebook_url
end

#gplus_urlObject (readonly)

Returns the value of attribute gplus_url.



19
20
21
# File 'lib/rubykhan.rb', line 19

def gplus_url
  @gplus_url
end

#hideObject (readonly)

Returns the value of attribute hide.



19
20
21
# File 'lib/rubykhan.rb', line 19

def hide
  @hide
end

#icon_srcObject (readonly)

Returns the value of attribute icon_src.



19
20
21
# File 'lib/rubykhan.rb', line 19

def icon_src
  @icon_src
end

#idObject (readonly)

Returns the value of attribute id.



19
20
21
# File 'lib/rubykhan.rb', line 19

def id
  @id
end

#in_knowledge_mapObject (readonly)

Returns the value of attribute in_knowledge_map.



19
20
21
# File 'lib/rubykhan.rb', line 19

def in_knowledge_map
  @in_knowledge_map
end

#in_topic_browserObject (readonly)

Returns the value of attribute in_topic_browser.



19
20
21
# File 'lib/rubykhan.rb', line 19

def in_topic_browser
  @in_topic_browser
end

#ka_urlObject (readonly)

Returns the value of attribute ka_url.



19
20
21
# File 'lib/rubykhan.rb', line 19

def ka_url
  @ka_url
end

#kindObject (readonly)

Returns the value of attribute kind.



19
20
21
# File 'lib/rubykhan.rb', line 19

def kind
  @kind
end

#logo_image_urlObject (readonly)

Returns the value of attribute logo_image_url.



19
20
21
# File 'lib/rubykhan.rb', line 19

def logo_image_url
  @logo_image_url
end

#node_slugObject (readonly)

Returns the value of attribute node_slug.



19
20
21
# File 'lib/rubykhan.rb', line 19

def node_slug
  @node_slug
end

#old_key_nameObject (readonly)

Returns the value of attribute old_key_name.



19
20
21
# File 'lib/rubykhan.rb', line 19

def old_key_name
  @old_key_name
end

#relative_urlObject (readonly)

Returns the value of attribute relative_url.



19
20
21
# File 'lib/rubykhan.rb', line 19

def relative_url
  @relative_url
end

#render_typeObject (readonly)

Returns the value of attribute render_type.



19
20
21
# File 'lib/rubykhan.rb', line 19

def render_type
  @render_type
end

#shaObject (readonly)

Returns the value of attribute sha.



19
20
21
# File 'lib/rubykhan.rb', line 19

def sha
  @sha
end

#slugObject (readonly)

Returns the value of attribute slug.



19
20
21
# File 'lib/rubykhan.rb', line 19

def slug
  @slug
end

#standalone_titleObject (readonly)

Returns the value of attribute standalone_title.



19
20
21
# File 'lib/rubykhan.rb', line 19

def standalone_title
  @standalone_title
end

#tagsObject (readonly)

Returns the value of attribute tags.



19
20
21
# File 'lib/rubykhan.rb', line 19

def tags
  @tags
end

#titleObject (readonly)

Returns the value of attribute title.



19
20
21
# File 'lib/rubykhan.rb', line 19

def title
  @title
end

#topic_page_urlObject (readonly)

Returns the value of attribute topic_page_url.



19
20
21
# File 'lib/rubykhan.rb', line 19

def topic_page_url
  @topic_page_url
end

#translated_descriptionObject (readonly)

Returns the value of attribute translated_description.



19
20
21
# File 'lib/rubykhan.rb', line 19

def translated_description
  @translated_description
end

#translated_standalone_titleObject (readonly)

Returns the value of attribute translated_standalone_title.



19
20
21
# File 'lib/rubykhan.rb', line 19

def translated_standalone_title
  @translated_standalone_title
end

#translated_titleObject (readonly)

Returns the value of attribute translated_title.



19
20
21
# File 'lib/rubykhan.rb', line 19

def translated_title
  @translated_title
end

#twitter_urlObject (readonly)

Returns the value of attribute twitter_url.



19
20
21
# File 'lib/rubykhan.rb', line 19

def twitter_url
  @twitter_url
end

#web_urlObject (readonly)

Returns the value of attribute web_url.



19
20
21
# File 'lib/rubykhan.rb', line 19

def web_url
  @web_url
end

#x_posObject (readonly)

Returns the value of attribute x_pos.



19
20
21
# File 'lib/rubykhan.rb', line 19

def x_pos
  @x_pos
end

#y_posObject (readonly)

Returns the value of attribute y_pos.



19
20
21
# File 'lib/rubykhan.rb', line 19

def y_pos
  @y_pos
end

Class Method Details

.all(key = "extended_slug") ⇒ Object



35
36
37
38
39
# File 'lib/rubykhan.rb', line 35

def self.all(key = "extended_slug")
	uri = "http://www.khanacademy.org/api/v1/topictree"
	options = KhanAcademy::Playlist.get(uri).to_hash
	values(options, key)
end

.get_info(topic) ⇒ Object



29
30
31
32
33
# File 'lib/rubykhan.rb', line 29

def self.get_info(topic)
	uri = "http://www.KhanAcademy.org/api/v1/topic/#{topic}"
	options = KhanAcademy::Playlist.get(uri)
	new(options)
end

.treeObject



41
42
43
44
# File 'lib/rubykhan.rb', line 41

def self.tree
	uri = "http://www.khanacademy.org/api/v1/topictree"
	topictree = KhanAcademy::Playlist.get(uri)
end