Class: KhanAcademy::Topic

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Topic



24
25
26
27
28
29
30
# File 'lib/rubykhan.rb', line 24

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.



22
23
24
# File 'lib/rubykhan.rb', line 22

def assessment_progress_key
  @assessment_progress_key
end

#background_image_captionObject (readonly)

Returns the value of attribute background_image_caption.



22
23
24
# File 'lib/rubykhan.rb', line 22

def background_image_caption
  @background_image_caption
end

#background_image_urlObject (readonly)

Returns the value of attribute background_image_url.



22
23
24
# File 'lib/rubykhan.rb', line 22

def background_image_url
  @background_image_url
end

#backup_timestampObject (readonly)

Returns the value of attribute backup_timestamp.



22
23
24
# File 'lib/rubykhan.rb', line 22

def backup_timestamp
  @backup_timestamp
end

#child_dataObject (readonly)

Returns the value of attribute child_data.



22
23
24
# File 'lib/rubykhan.rb', line 22

def child_data
  @child_data
end

#childrenObject (readonly)

Returns the value of attribute children.



22
23
24
# File 'lib/rubykhan.rb', line 22

def children
  @children
end

#content_kindObject (readonly)

Returns the value of attribute content_kind.



22
23
24
# File 'lib/rubykhan.rb', line 22

def content_kind
  @content_kind
end

#current_revision_keyObject (readonly)

Returns the value of attribute current_revision_key.



22
23
24
# File 'lib/rubykhan.rb', line 22

def current_revision_key
  @current_revision_key
end

#deletedObject (readonly)

Returns the value of attribute deleted.



22
23
24
# File 'lib/rubykhan.rb', line 22

def deleted
  @deleted
end

#deleted_mod_timeObject (readonly)

Returns the value of attribute deleted_mod_time.



22
23
24
# File 'lib/rubykhan.rb', line 22

def deleted_mod_time
  @deleted_mod_time
end

#descriptionObject (readonly)

Returns the value of attribute description.



22
23
24
# File 'lib/rubykhan.rb', line 22

def description
  @description
end

#domain_slugObject (readonly)

Returns the value of attribute domain_slug.



22
23
24
# File 'lib/rubykhan.rb', line 22

def domain_slug
  @domain_slug
end

#extended_slugObject (readonly)

Returns the value of attribute extended_slug.



22
23
24
# File 'lib/rubykhan.rb', line 22

def extended_slug
  @extended_slug
end

#facebook_urlObject (readonly)

Returns the value of attribute facebook_url.



22
23
24
# File 'lib/rubykhan.rb', line 22

def facebook_url
  @facebook_url
end

#gplus_urlObject (readonly)

Returns the value of attribute gplus_url.



22
23
24
# File 'lib/rubykhan.rb', line 22

def gplus_url
  @gplus_url
end

#hideObject (readonly)

Returns the value of attribute hide.



22
23
24
# File 'lib/rubykhan.rb', line 22

def hide
  @hide
end

#icon_srcObject (readonly)

Returns the value of attribute icon_src.



22
23
24
# File 'lib/rubykhan.rb', line 22

def icon_src
  @icon_src
end

#idObject (readonly)

Returns the value of attribute id.



22
23
24
# File 'lib/rubykhan.rb', line 22

def id
  @id
end

#in_knowledge_mapObject (readonly)

Returns the value of attribute in_knowledge_map.



22
23
24
# File 'lib/rubykhan.rb', line 22

def in_knowledge_map
  @in_knowledge_map
end

#in_topic_browserObject (readonly)

Returns the value of attribute in_topic_browser.



22
23
24
# File 'lib/rubykhan.rb', line 22

def in_topic_browser
  @in_topic_browser
end

#ka_urlObject (readonly)

Returns the value of attribute ka_url.



22
23
24
# File 'lib/rubykhan.rb', line 22

def ka_url
  @ka_url
end

#kindObject (readonly)

Returns the value of attribute kind.



22
23
24
# File 'lib/rubykhan.rb', line 22

def kind
  @kind
end

#logo_image_urlObject (readonly)

Returns the value of attribute logo_image_url.



22
23
24
# File 'lib/rubykhan.rb', line 22

def logo_image_url
  @logo_image_url
end

#node_slugObject (readonly)

Returns the value of attribute node_slug.



22
23
24
# File 'lib/rubykhan.rb', line 22

def node_slug
  @node_slug
end

#old_key_nameObject (readonly)

Returns the value of attribute old_key_name.



22
23
24
# File 'lib/rubykhan.rb', line 22

def old_key_name
  @old_key_name
end

#relative_urlObject (readonly)

Returns the value of attribute relative_url.



22
23
24
# File 'lib/rubykhan.rb', line 22

def relative_url
  @relative_url
end

#render_typeObject (readonly)

Returns the value of attribute render_type.



22
23
24
# File 'lib/rubykhan.rb', line 22

def render_type
  @render_type
end

#shaObject (readonly)

Returns the value of attribute sha.



22
23
24
# File 'lib/rubykhan.rb', line 22

def sha
  @sha
end

#slugObject (readonly)

Returns the value of attribute slug.



22
23
24
# File 'lib/rubykhan.rb', line 22

def slug
  @slug
end

#standalone_titleObject (readonly)

Returns the value of attribute standalone_title.



22
23
24
# File 'lib/rubykhan.rb', line 22

def standalone_title
  @standalone_title
end

#tagsObject (readonly)

Returns the value of attribute tags.



22
23
24
# File 'lib/rubykhan.rb', line 22

def tags
  @tags
end

#titleObject (readonly)

Returns the value of attribute title.



22
23
24
# File 'lib/rubykhan.rb', line 22

def title
  @title
end

#topic_page_urlObject (readonly)

Returns the value of attribute topic_page_url.



22
23
24
# File 'lib/rubykhan.rb', line 22

def topic_page_url
  @topic_page_url
end

#translated_descriptionObject (readonly)

Returns the value of attribute translated_description.



22
23
24
# File 'lib/rubykhan.rb', line 22

def translated_description
  @translated_description
end

#translated_standalone_titleObject (readonly)

Returns the value of attribute translated_standalone_title.



22
23
24
# File 'lib/rubykhan.rb', line 22

def translated_standalone_title
  @translated_standalone_title
end

#translated_titleObject (readonly)

Returns the value of attribute translated_title.



22
23
24
# File 'lib/rubykhan.rb', line 22

def translated_title
  @translated_title
end

#twitter_urlObject (readonly)

Returns the value of attribute twitter_url.



22
23
24
# File 'lib/rubykhan.rb', line 22

def twitter_url
  @twitter_url
end

#web_urlObject (readonly)

Returns the value of attribute web_url.



22
23
24
# File 'lib/rubykhan.rb', line 22

def web_url
  @web_url
end

#x_posObject (readonly)

Returns the value of attribute x_pos.



22
23
24
# File 'lib/rubykhan.rb', line 22

def x_pos
  @x_pos
end

#y_posObject (readonly)

Returns the value of attribute y_pos.



22
23
24
# File 'lib/rubykhan.rb', line 22

def y_pos
  @y_pos
end

Class Method Details

.allObject



38
39
40
41
42
# File 'lib/rubykhan.rb', line 38

def self.all
  uri = "http://www.khanacademy.org/api/v1/topictree"
  options = HTTParty.get(uri).to_hash
  values(options, 'slug')
end

.get_info(topic) ⇒ Object



32
33
34
35
36
# File 'lib/rubykhan.rb', line 32

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