Class: Strava::Comment

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

Overview

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

Instance Attribute Summary collapse

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 Attribute Details

#activity_idObject (readonly)

Returns the value of attribute activity_id.



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

def activity_id
  @activity_id
end

Instance Method Details

#deleteObject



18
19
20
# File 'lib/strava/comment.rb', line 18

def delete
  res = client.delete(path_base).to_h
end

#path_baseObject



22
23
24
# File 'lib/strava/comment.rb', line 22

def path_base
  "activities/#{activity_id}/comments/#{id}"
end

#update(data, **opts) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/strava/comment.rb', line 8

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

  @text           = data['text']
  @activity_id    = data['activity_id']
  @athlete        = Athlete.new(data['athlete'], client: @client)
end