Sha256: f7f5aabe8356e140cc17dd79834d437fb91136a25dd13002efcb1337cc5193e3

Contents?: true

Size: 766 Bytes

Versions: 7

Compression:

Stored size: 766 Bytes

Contents

class Person < Praxis::MediaType
  attributes do 
    attribute :id, Integer
    attribute :name, String, example: /[:name:]/
    attribute :href, String, example: proc { |person| "/people/#{person.id}" }
  end

  view :default do
    attribute :id
    attribute :name
  end

  view :link do
    attribute :id
    attribute :name
    attribute :href
  end
end


class Address < Praxis::MediaType
  identifier 'application/json'

  description 'Address MediaType'

  attributes do
    attribute :id, Integer
    attribute :name, String

    attribute :owner, Person

    links do
      link :owner
      link :super, Person, using: :manager
    end

  end

  view :default do
    attribute :id
    attribute :name
    attribute :owner

    attribute :links
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
praxis-0.11.2 spec/support/spec_media_types.rb
praxis-0.11.1 spec/support/spec_media_types.rb
praxis-0.11 spec/support/spec_media_types.rb
praxis-0.11pre spec/support/spec_media_types.rb
praxis-0.10.1 spec/support/spec_media_types.rb
praxis-0.10.0 spec/support/spec_media_types.rb
praxis-0.9 spec/support/spec_media_types.rb