Sha256: d3741c3137ee6ef9dbb9bcab72217124e50532cf8a58a52d85efd2b5b86c2ded

Contents?: true

Size: 1.47 KB

Versions: 5

Compression:

Stored size: 1.47 KB

Contents

class ReactiveResource::Base
  self.site = "https://api.avvo.com/"
  self.prefix = "/api/1/"
  self.format = :json
end

class ReactiveResource::Lawyer < ReactiveResource::Base
  has_one :headshot
  has_many :addresses
end

# half the complications in here come from the fact that we have
# resources shared with one of two different types of parents
class ReactiveResource::Doctor < ReactiveResource::Base
  has_one :headshot
  has_many :addresses
end

class ReactiveResource::Headshot < ReactiveResource::Base
  singleton
  belongs_to :lawyer
  belongs_to :doctor
end

class ReactiveResource::Address < ReactiveResource::Base
  belongs_to :lawyer
  belongs_to :doctor
  has_many :phones
end

class ReactiveResource::Phone < ReactiveResource::Base
  belongs_to :address
end

class ReactiveResource::Post < ReactiveResource::Base
  has_one :lawyer_post
end

class ReactiveResource::LawyerPost < ReactiveResource::Base
  belongs_to :lawyer
  belongs_to :post
end

module ChildResource
  
  class Address < ReactiveResource::Address
    belongs_to :lawyer, :class_name => "ReactiveResource::Lawyer"
    belongs_to :doctor, :class_name => "ReactiveResource::Doctor"
  end

  class Phone < ReactiveResource::Address
  end
end

module ActiveResource
  module Formats
    module NoFormatFormat
      extend ActiveResource::Formats::JsonFormat
      extend self
      def extension
        ''
      end
    end
  end
end

class ReactiveResource::NoExtension < ReactiveResource::Base
  self.format = :no_format
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
reactive_resource-0.7.2 test/test_objects.rb
reactive_resource-0.7.1 test/test_objects.rb
reactive_resource-0.7.0 test/test_objects.rb
reactive_resource-0.6.1 test/test_objects.rb
reactive_resource-0.6.0 test/test_objects.rb