Sha256: 09739c455bbe2405c2fc57a0dad50f28c2373e8cbca960cc48243c84d497a74a

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 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

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

class ReactiveResource::Phone < ReactiveResource::Base
  belongs_to :address
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

3 entries across 3 versions & 1 rubygems

Version Path
reactive_resource-0.5.1 test/test_objects.rb
reactive_resource-0.5.0 test/test_objects.rb
reactive_resource-0.0.1 test/test_objects.rb