Sha256: afa30b8d2df2683c5004d54bf680734dd4759928970e26d1bf9401deb223f971

Contents?: true

Size: 560 Bytes

Versions: 1

Compression:

Stored size: 560 Bytes

Contents

require_relative 'site'

module CodeBadges
  # Service object class that takes credentials and username
  # returns a hash of user's badges information
  class GetCodecademyBadges
    def initialize(username, password)
      @username = username
      @password = password
    end

    def call(cadet)
      CademySite.new do |site|
        site.goto CademySite::LOGIN_URL
        site.login(@username, @password)
        site.goto CademySite.cadet_achievements_url(cadet)
        @badges = site.extract_achievements
      end

      @badges
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
codebadges-3.0.0 lib/codebadges/badges.rb