Class: Hypem::Blog

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/hypem/blog.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helper

included, #update_from_response

Constructor Details

#initialize(*args) ⇒ Blog

Returns a new instance of Blog.



12
13
14
15
16
# File 'lib/hypem/blog.rb', line 12

def initialize(*args)
  if args.count == 1
    @id = args.first.is_a?(Integer) ? args.first : args.first.to_i
  end
end

Instance Attribute Details

#blog_imageObject (readonly)

Returns the value of attribute blog_image.



5
6
7
# File 'lib/hypem/blog.rb', line 5

def blog_image
  @blog_image
end

#blog_image_smallObject (readonly)

Returns the value of attribute blog_image_small.



5
6
7
# File 'lib/hypem/blog.rb', line 5

def blog_image_small
  @blog_image_small
end

#first_postedObject (readonly)

Returns the value of attribute first_posted.



5
6
7
# File 'lib/hypem/blog.rb', line 5

def first_posted
  @first_posted
end

#followersObject (readonly)

Returns the value of attribute followers.



5
6
7
# File 'lib/hypem/blog.rb', line 5

def followers
  @followers
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/hypem/blog.rb', line 5

def id
  @id
end

#last_postedObject (readonly)

Returns the value of attribute last_posted.



5
6
7
# File 'lib/hypem/blog.rb', line 5

def last_posted
  @last_posted
end

#site_nameObject (readonly)

Returns the value of attribute site_name.



5
6
7
# File 'lib/hypem/blog.rb', line 5

def site_name
  @site_name
end

#site_urlObject (readonly)

Returns the value of attribute site_url.



5
6
7
# File 'lib/hypem/blog.rb', line 5

def site_url
  @site_url
end

#total_tracksObject (readonly)

Returns the value of attribute total_tracks.



5
6
7
# File 'lib/hypem/blog.rb', line 5

def total_tracks
  @total_tracks
end

Class Method Details

.allObject



24
25
26
27
# File 'lib/hypem/blog.rb', line 24

def self.all
  response = Request.get_resource("/get_all_blogs")
  response.map { |b| self.new.tap {|blog| blog.update_from_response(b) } }
end

Instance Method Details

#get_infoObject



18
19
20
21
22
# File 'lib/hypem/blog.rb', line 18

def get_info
  response = Request.get_resource("/get_site_info?siteid=#{id}")
  update_from_response(response)
  self
end