require 'nike_2_runkeeper/version'
require 'nike'
require 'runkeeper'

module Nike2Runkeeper
  class NikeClient
    attr_accessor :activities, :client

    def initialize(username, password)
      @activities = Array.new
      @client = Nike::Client.new(username, password)
    end

    def get_activities
      nike_activities = @client.activities

      nike_activities.each do |a|
        @activities << @client.activity(a.activity_id)
      end
    end

  end
end

require 'nike_2_runkeeper/version'
require 'nike'
require 'runkeeper'

module Nike2Runkeeper
  class NikeClient
    attr_accessor :activities, :client

    def initialize(username, password)
      @activities = Array.new
      @client = Nike::Client.new(username, password)
    end

    def get_activities
      return @activities if @activities

      nike_activities = @client.activities
      nike_activities.each do |a|
        @activities << @client.activity(a.activity_id)
      end
    end

  end
end

Add short circuit for activities
Add short circuit for activities

This commit adds a short circuit for activities so we don't try and make
the call multiple times unnecessarily.
