Sha256: f423b71f9db8f393f58967cfdecba305c6df3e005507e5e2d32416f7d6333377

Contents?: true

Size: 853 Bytes

Versions: 1

Compression:

Stored size: 853 Bytes

Contents

module Strava
  # Class to represent Strava Activity
  # https://strava.github.io/api/v3/activities/
  class Comment < Base

    attr_reader :activity_id

    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

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

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

__END__

ca = Strava::Athlete.current_athlete;
ca.activities;
ca.activities(page: 2);
ca.activities(page: 3);
ca.activities(page: 4);
act = ca.activities.detect{|act| act.response['comment_count'] > 0 && act.response['kudos_count'] > 0 }
act.comments

Version data entries

1 entries across 1 versions & 1 rubygems

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