Sha256: 1f7f78a41452509e9583eea5725fee005958b5c02b40c338225b73c113c2969d

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 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}" }
    attribute :links, silence_warnings { Praxis::Collection.of(String) } 
  end

  view :default do
    attribute :id
    attribute :name
    attribute :links
  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

1 entries across 1 versions & 1 rubygems

Version Path
praxis-0.14.0 spec/support/spec_media_types.rb