Sha256: c04e5310ded4414f2e4c53ac3e5f3bf02862321cce3c7b49692accde9c6f49be

Contents?: true

Size: 943 Bytes

Versions: 6

Compression:

Stored size: 943 Bytes

Contents

Acfs.configure do
  locate :user_service, 'http://users.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 MyUserInherited < 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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
acfs-0.21.0.b185 spec/support/service.rb
acfs-0.20.0.dev.b184 spec/support/service.rb
acfs-0.21.0 spec/support/service.rb
acfs-0.20.0.dev.b183 spec/support/service.rb
acfs-0.20.0.dev.b182 spec/support/service.rb
acfs-0.20.0.dev.b181 spec/support/service.rb