Sha256: f38088b8aa14c3016a2b625f5eee5f34222f67eb3b299067763fb8b3027976b8

Contents?: true

Size: 946 Bytes

Versions: 1

Compression:

Stored size: 946 Bytes

Contents

module Strava
  # Gear represents both shoes and bikes.
  # These are returned as part of the athlete summary.
  # 
  # @see https://strava.github.io/api/v3/gear/ Strava Gear API Docs
  class Gear < Base

    # Updates gear with passed data attributes.
    # 
    # @param data [Hash] data hash containing gear data
    # @return [self]
    def update(data, **opts)
      @response = data
      @id                     = data['id']
      @resource_state         = data['resource_state']
      self
    end

    # Retrieve full details for Gear object.
    # Sets all data attributes on self.
    # 
    # @return [Hash] raw API response
    def get_details
      return self if detailed?
      res = client.get(path_base).to_h
      update(res)
      res
    end

    # URL path for Gear object.
    # 
    # @return [String] URL path
    private def path_base
      "gear/#{id}"
    end
  end
end

__END__

ca = Strava::Athlete.current_athlete;

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strava-0.1.0 lib/strava/gear.rb