Sha256: 91f89f1044017e7f5acd528a4944c0c6c77a17e21c7b3e7c9208c51d2e2d3950

Contents?: true

Size: 844 Bytes

Versions: 26

Compression:

Stored size: 844 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" unless identifier_type.present?
    raise "must provide an identifier_value" unless identifier_value.present?

    # 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

26 entries across 26 versions & 1 rubygems

Version Path
test_track_rails_client-2.0.0 app/models/test_track/remote/visitor.rb
test_track_rails_client-1.3.0 app/models/test_track/remote/visitor.rb
test_track_rails_client-1.2.0 app/models/test_track/remote/visitor.rb
test_track_rails_client-1.1.0 app/models/test_track/remote/visitor.rb
test_track_rails_client-1.0.0 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.20 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.19 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.18 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.17 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.16 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.15 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.14 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.13 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.12 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.11 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.10 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.9 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.8 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.7 app/models/test_track/remote/visitor.rb
test_track_rails_client-0.9.6 app/models/test_track/remote/visitor.rb