Class: Strava::Gear

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

Overview

Gear represents both shoes and bikes. These are returned as part of the athlete summary.

Instance Attribute Summary

Attributes inherited from Base

#client, #id, #response

Instance Method Summary collapse

Methods inherited from Base

#detailed?, #initialize, #resource_state, resource_states, #summary?

Constructor Details

This class inherits a constructor from Strava::Base

Instance Method Details

#get_detailsHash

Retrieve full details for Gear object. Sets all data attributes on self.

Returns:

  • (Hash)

    raw API response



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

def get_details
  return self if detailed?
  res = client.get(path_base).to_h
  update(res)
  res
end

#update(data, **opts) ⇒ self

Updates gear with passed data attributes.

Parameters:

  • data (Hash)

    data hash containing gear data

Returns:

  • (self)


12
13
14
15
16
17
# File 'lib/strava/gear.rb', line 12

def update(data, **opts)
  @response = data
  @id                     = data['id']
  @resource_state         = data['resource_state']
  self
end