Class: Scrobbler::Chart

Inherits:
Base
  • Object
show all
Defined in:
lib/scrobbler/chart.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Base

connection, fetch_and_parse

Constructor Details

- (Chart) initialize(from, to)

Returns a new instance of Chart

Raises:

  • (ArgumentError)


8
9
10
11
12
13
# File 'lib/scrobbler/chart.rb', line 8

def initialize(from, to)
  raise ArgumentError, "From is required" if from.blank?
  raise ArgumentError, "To is required" if to.blank?
  @from = from
  @to = to
end

Class Method Details

+ (Object) new_from_xml(xml, doc)



4
5
6
# File 'lib/scrobbler/chart.rb', line 4

def new_from_xml(xml, doc)
  Chart.new(xml['from'], xml['to'])
end

Instance Method Details

- (Object) from



23
24
25
# File 'lib/scrobbler/chart.rb', line 23

def from
  @from.to_i
end

- (Object) from=(value)



15
16
17
# File 'lib/scrobbler/chart.rb', line 15

def from=(value)
  @from = value.to_i
end

- (Object) to



27
28
29
# File 'lib/scrobbler/chart.rb', line 27

def to
  @to.to_i
end

- (Object) to=(value)



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

def to=(value)
  @to = value.to_i
end