Sha256: a8f79a9687ae9319342cc05550dafad84ed8416c3c3c1785880925bd37a5f031

Contents?: true

Size: 832 Bytes

Versions: 37

Compression:

Stored size: 832 Bytes

Contents

class TestTrack::Remote::Visitor
  include TestTrack::RemoteModel

  collection_path '/api/v1/visitors'

  has_many :assignments

  def self.from_identifier(identifier_type, identifier_value)
    raise "must provide an identifier_type" if identifier_type.blank?
    raise "must provide an identifier_value" if identifier_value.blank?

    # TODO: FakeableHer needs to make this faking a feature of `get`
    if faked?
      new(fake_instance_attributes(nil))
    else
      get("/api/v1/identifier_types/#{identifier_type}/identifiers/#{identifier_value}/visitor")
    end
  end

  def self.fake_instance_attributes(_)
    {
      id: "fake_visitor_id",
      assignments: [
        TestTrack::Remote::Assignment.fake_instance_attributes(1),
        TestTrack::Remote::Assignment.fake_instance_attributes(2)
      ]
    }
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
test_track_rails_client-4.0.0.alpha15 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha14 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha13 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha12 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha11 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha10 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha9 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha8 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha7 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha6 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha5 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha4 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha3 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha2 app/models/test_track/remote/visitor.rb
test_track_rails_client-4.0.0.alpha1 app/models/test_track/remote/visitor.rb
test_track_rails_client-3.0.1 app/models/test_track/remote/visitor.rb
test_track_rails_client-3.0.0 app/models/test_track/remote/visitor.rb