Class: Strava::Models::ExplorerSegment

Inherits:
Response show all
Includes:
Mixins::Distance
Defined in:
lib/strava/models/explorer_segment.rb

Overview

Represents a segment found via segment exploration.

Used when searching for segments in a geographic area. Contains basic segment information including location, elevation, and difficulty category.

Examples:

Exploring segments near a location

segments = client.explore_segments(
  bounds: [37.7, -122.5, 37.8, -122.4],  # [sw_lat, sw_lng, ne_lat, ne_lng]
  activity_type: 'running'
)

segments.each do |segment|
  puts "#{segment.name} (#{segment.distance_s})"
  puts "  Climb: #{segment.climb_category_desc}"
  puts "  Grade: #{segment.avg_grade}%"
  puts "  Elevation: #{segment.elev_difference}m"
  puts "  Starred: #{segment.starred}"
end

See Also:

Instance Method Summary collapse

Methods included from Mixins::Distance

#distance_in_feet, #distance_in_kilometers, #distance_in_kilometers_s, #distance_in_meters, #distance_in_meters_s, #distance_in_miles, #distance_in_miles_s, #distance_in_yards, #distance_in_yards_s, #distance_s

Instance Method Details

#avg_gradeFloat

Returns Average grade/incline as a percentage.

Returns:

  • (Float)

    Average grade/incline as a percentage



43
# File 'lib/strava/models/explorer_segment.rb', line 43

property 'avg_grade'

#climb_categoryInteger

Returns Climb category (0=uncategorized, 5=easiest, 1=hardest, HC=hors catégorie).

Returns:

  • (Integer)

    Climb category (0=uncategorized, 5=easiest, 1=hardest, HC=hors catégorie)



37
# File 'lib/strava/models/explorer_segment.rb', line 37

property 'climb_category'

#climb_category_descString

Returns Human-readable description of climb category (e.g., "NC", "4", "3", "2", "1", "HC").

Returns:

  • (String)

    Human-readable description of climb category (e.g., "NC", "4", "3", "2", "1", "HC")



40
# File 'lib/strava/models/explorer_segment.rb', line 40

property 'climb_category_desc'

#elev_differenceFloat

Returns Net elevation difference in meters (positive for climbs, negative for descents).

Returns:

  • (Float)

    Net elevation difference in meters (positive for climbs, negative for descents)



52
# File 'lib/strava/models/explorer_segment.rb', line 52

property 'elev_difference'

#elevation_profileString?

Note:

Not documented by Strava API

Returns URL or path to elevation profile visualization.

Returns:

  • (String, nil)

    URL or path to elevation profile visualization



70
# File 'lib/strava/models/explorer_segment.rb', line 70

property 'elevation_profile'

#end_latlngLatLng

Returns GPS coordinates of segment end point.

Returns:

  • (LatLng)

    GPS coordinates of segment end point



49
# File 'lib/strava/models/explorer_segment.rb', line 49

property 'end_latlng', transform_with: ->(v) { Strava::Models::LatLng.new(v) }

#idInteger

Returns Unique identifier for this segment.

Returns:

  • (Integer)

    Unique identifier for this segment



31
# File 'lib/strava/models/explorer_segment.rb', line 31

property 'id'

#local_legend_enabledBoolean?

Note:

Not documented by Strava API

Returns Whether local legend feature is enabled for this segment.

Returns:

  • (Boolean, nil)

    Whether local legend feature is enabled for this segment



74
# File 'lib/strava/models/explorer_segment.rb', line 74

property 'local_legend_enabled'

#nameString

Returns Name of the segment.

Returns:

  • (String)

    Name of the segment



34
# File 'lib/strava/models/explorer_segment.rb', line 34

property 'name'

#pointsString?

Returns Encoded polyline of the segment path.

Returns:

  • (String, nil)

    Encoded polyline of the segment path



58
# File 'lib/strava/models/explorer_segment.rb', line 58

property 'points'

#resource_stateInteger

Note:

Not documented by Strava API

Returns Resource state indicator.

Returns:

  • (Integer)

    Resource state indicator



62
# File 'lib/strava/models/explorer_segment.rb', line 62

property 'resource_state'

#starredBoolean?

Note:

Not documented by Strava API

Returns Whether the current athlete has starred this segment.

Returns:

  • (Boolean, nil)

    Whether the current athlete has starred this segment



66
# File 'lib/strava/models/explorer_segment.rb', line 66

property 'starred'

#start_latlngLatLng

Returns GPS coordinates of segment start point.

Returns:

  • (LatLng)

    GPS coordinates of segment start point



46
# File 'lib/strava/models/explorer_segment.rb', line 46

property 'start_latlng', transform_with: ->(v) { Strava::Models::LatLng.new(v) }