Class: Strava::Stream

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Stream

Returns a new instance of Stream.



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

def initialize(data)
  # @response = data
  @id             = data["id"]
  
  @type           = data["type"]          # => "latlng",
  @data           = data["data"]          # => [...],
  @series_type    = data["series_type"]   # => "distance",
  @original_size  = data["original_size"] # => 512,
  @resolution     = data["resolution"]    # => "low"

  self
end

Instance Attribute Details

#dataObject (readonly)

Class to represent Strava Stream https://strava.github.io/api/v3/activities/



6
7
8
# File 'lib/strava/stream.rb', line 6

def data
  @data
end

#typeObject (readonly)

Class to represent Strava Stream https://strava.github.io/api/v3/activities/



6
7
8
# File 'lib/strava/stream.rb', line 6

def type
  @type
end

Instance Method Details

#[](i) ⇒ Object



24
25
26
# File 'lib/strava/stream.rb', line 24

def [](i)
  @data[i]
end

#sizeObject



21
22
23
# File 'lib/strava/stream.rb', line 21

def size
  @data.size
end