Class: Strava::Route::Images

Inherits:
Object
  • Object
show all
Defined in:
lib/strava/route/images.rb,
lib/strava/route/images/version.rb

Constant Summary collapse

VERSION =
"0.1.1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, options = {}) ⇒ Images

Returns a new instance of Images.



13
14
15
16
17
18
19
20
# File 'lib/strava/route/images.rb', line 13

def initialize(url, options = {})
  raise ::Strava::Route::InvalidUrl unless url.match?(/strava.com/)

  @url       = url
  @base      = options[:base]      ||= "#{Tempfile.new('strava-base').path}.png"
  @route     = options[:route]     ||= "#{Tempfile.new('strava-route').path}.png"
  @altimetry = options[:altimetry] ||= "#{Tempfile.new('strava-altimetry').path}.png"
end

Instance Attribute Details

#altimetryObject (readonly)

Returns the value of attribute altimetry.



11
12
13
# File 'lib/strava/route/images.rb', line 11

def altimetry
  @altimetry
end

#baseObject (readonly)

Returns the value of attribute base.



11
12
13
# File 'lib/strava/route/images.rb', line 11

def base
  @base
end

#routeObject (readonly)

Returns the value of attribute route.



11
12
13
# File 'lib/strava/route/images.rb', line 11

def route
  @route
end

#urlObject (readonly)

Returns the value of attribute url.



11
12
13
# File 'lib/strava/route/images.rb', line 11

def url
  @url
end

Instance Method Details

#extractObject



22
23
24
25
26
27
28
# File 'lib/strava/route/images.rb', line 22

def extract
  {
    base:      extract_screenshot,
    route:     extract_route,
    altimetry: extract_altimetry
  }
end