Sha256: 2f182c9af5c440e779750fe25c9d99ae05dc0ffc2f65a7caf36093cf97dede0d

Contents?: true

Size: 760 Bytes

Versions: 5

Compression:

Stored size: 760 Bytes

Contents

MotionResource::Base.root_url = 'http://example.com/'

class Post < MotionResource::Base
  attr_accessor :text
  
  self.member_url = 'posts/:id'
  
  has_many :comments
end

class Comment < MotionResource::Base
  attr_accessor :post_id, :text
  
  self.member_url = 'comments/:id'
  self.collection_url = 'comments'
  
  belongs_to :post
  
  scope :recent, :url => 'comments/recent'
  
  custom_urls :by_user_url => 'comments/by_user/:name'
end

class User < MotionResource::Base
  self.member_url = 'users/:id'
  
  has_one :profile
end

class Profile < MotionResource::Base
  attr_accessor :name, :email
end

class Shape < MotionResource::Base
  attribute :contents, :position
  attr_accessor :created_at
end

class Rectangle < Shape
  attribute :size
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
motion-resource-0.1.2 spec/env.rb
motion-resource-0.1.1 spec/env.rb
motion-resource-0.1.0 spec/env.rb
motion-resource-0.0.2 spec/env.rb
motion-resource-0.0.1 spec/env.rb