Sha256: fd5b88345e99de60f516d39b14258560f129211708651f08c520514a8ff89ff0

Contents?: true

Size: 522 Bytes

Versions: 7

Compression:

Stored size: 522 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_name"]
      @nps = attrs["nps"].to_f
      @organization_nps = attrs["organization_nps"].to_f
    end

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

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
promoter-0.9.5 lib/promoter/metric.rb
promoter-0.9.4 lib/promoter/metric.rb
promoter-0.9.3 lib/promoter/metric.rb
promoter-0.9.2 lib/promoter/metric.rb
promoter-0.9.1 lib/promoter/metric.rb
promoter-0.9.0 lib/promoter/metric.rb
promoter-0.2.0 lib/promoter/metric.rb