Sha256: d0d47251140f1961bd57c896bc75ab68eb058c8b892e9a95945c80394ae54158

Contents?: true

Size: 1.42 KB

Versions: 24

Compression:

Stored size: 1.42 KB

Contents

Acfs.configure do
  locate :user_service, 'http://users.example.org'
  locate :computer_service, 'http://computers.example.org'
  locate :comments, 'http://comments.example.org'
end

class UserService < Acfs::Service
  use Acfs::Middleware::MessagePackDecoder
  use Acfs::Middleware::JsonDecoder
  use Acfs::Middleware::JsonEncoder
end

class CommentService < Acfs::Service
  identity :comments

  use Acfs::Middleware::JsonDecoder
end

class MyUser < Acfs::Resource
  service UserService, path: 'users'

  attribute :id, :integer
  attribute :name, :string, default: 'Anon'
  attribute :age, :integer
end

class Customer < MyUser

end

class MyUserWithValidations < MyUser
  validates_presence_of :name, :age
  validates_format_of :name, with: /\A\w+\s+\w+.?\z/
end

class Session < Acfs::Resource
  service UserService

  attribute :id, :string
  attribute :user, :integer
end

class Comment < Acfs::Resource
  service CommentService

  attribute :id, :integer
  attribute :text, :string
end

class ComputerService < Acfs::Service
  use Acfs::Middleware::MessagePackDecoder
  use Acfs::Middleware::JsonDecoder
  use Acfs::Middleware::JsonEncoder
end

class Computer < Acfs::Resource
  service ComputerService, path: 'computers'

  attribute :id, :integer
end

class PC < Computer

end

class Mac < Computer

end

# DRAFT: Singular resource
#class Singular < Acfs::Resource
#  service UserService, singular: true
#
#  attribute :name, :string
#end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
acfs-0.25.0.1.b232 spec/support/service.rb
acfs-0.25.0.1.b229 spec/support/service.rb
acfs-0.25.0.1.b228 spec/support/service.rb
acfs-0.25.0.1.b227 spec/support/service.rb
acfs-0.25.0.1.b226 spec/support/service.rb
acfs-0.25.0.1.b225 spec/support/service.rb
acfs-0.25.0.1.b223 spec/support/service.rb
acfs-0.25.0.1.b221 spec/support/service.rb
acfs-0.25.0.1.b217 spec/support/service.rb
acfs-0.25.0 spec/support/service.rb
acfs-0.24.0.1.b216 spec/support/service.rb
acfs-0.24.0.1.b214 spec/support/service.rb
acfs-0.24.0.1.b212 spec/support/service.rb
acfs-0.24.0.b210 spec/support/service.rb
acfs-0.24.0 spec/support/service.rb
acfs-0.23.2.b209 spec/support/service.rb
acfs-0.23.2.b208 spec/support/service.rb
acfs-0.23.2.b206 spec/support/service.rb
acfs-0.23.2.b205 spec/support/service.rb
acfs-0.23.2.b204 spec/support/service.rb