Sha256: 9c82a770483f5636232ccbe8fc99d22ce62642eaa68f4fda0cdaae41d9e0996a

Contents?: true

Size: 439 Bytes

Versions: 6

Compression:

Stored size: 439 Bytes

Contents

module Promoter

  class Metric

    attr_accessor :campaign_name, :nps, :organization_nps

    API_URL = "https://app.promoter.io/api/metrics"

    def initialize(attrs)
      @campaign_name = attrs["campaign"]
      @nps = attrs["nps"].to_f
      @organization_nps = attrs["organization_nps"].to_f
    end

    def self.all
      response = Request.get("#{API_URL}/")
      response['results'].map {|attrs| new(attrs)}
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
promoter-0.1.9 lib/promoter/metric.rb
promoter-0.1.8 lib/promoter/metric.rb
promoter-0.1.7 lib/promoter/metric.rb
promoter-0.1.6 lib/promoter/metric.rb
promoter-0.1.5 lib/promoter/metric.rb
promoter-0.1.4 lib/promoter/metric.rb