Class: BcCrawler::Track

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(release, track) ⇒ Track

Returns a new instance of Track.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bc_crawler/track.rb', line 7

def initialize(release, track)
  @release            = release
  @duration           = track['duration']
  @track_num          = track['track_num']
  @is_downloadable    = track['is_downloadable']
  @streaming          = track['streaming']
  @is_draft           = track['is_draft']
  @id                 = track['id']
  @title_link         = track['title_link']
  @file               = track['file']
  @title              = track['title']
  @url                = "#{ BcCrawler::Helper.get_base_url(@release.url) }#{ track['title_link'] }"
end

Instance Attribute Details

#durationObject (readonly)

Returns the value of attribute duration.



4
5
6
# File 'lib/bc_crawler/track.rb', line 4

def duration
  @duration
end

#fileObject (readonly)

Returns the value of attribute file.



4
5
6
# File 'lib/bc_crawler/track.rb', line 4

def file
  @file
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/bc_crawler/track.rb', line 4

def id
  @id
end

#is_downloadableObject (readonly)

Returns the value of attribute is_downloadable.



4
5
6
# File 'lib/bc_crawler/track.rb', line 4

def is_downloadable
  @is_downloadable
end

#is_draftObject (readonly)

Returns the value of attribute is_draft.



4
5
6
# File 'lib/bc_crawler/track.rb', line 4

def is_draft
  @is_draft
end

#streamingObject (readonly)

Returns the value of attribute streaming.



4
5
6
# File 'lib/bc_crawler/track.rb', line 4

def streaming
  @streaming
end

#titleObject (readonly)

Returns the value of attribute title.



4
5
6
# File 'lib/bc_crawler/track.rb', line 4

def title
  @title
end

Returns the value of attribute title_link.



4
5
6
# File 'lib/bc_crawler/track.rb', line 4

def title_link
  @title_link
end

#track_numObject (readonly)

Returns the value of attribute track_num.



4
5
6
# File 'lib/bc_crawler/track.rb', line 4

def track_num
  @track_num
end

#urlObject (readonly)

Returns the value of attribute url.



4
5
6
# File 'lib/bc_crawler/track.rb', line 4

def url
  @url
end

Instance Method Details

#to_sObject



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

def to_s
  <<-EOF
  URL : #{ @url }
  Track number : #{ @track_num }
  Track name : #{ @title }
  Duration : #{ @duration }
  EOF
end