Advertisement
Guest User

Untitled

a guest
Apr 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 1.01 KB | None | 0 0
  1. module API::V1::Entities
  2.   class Proxy < Grape::Entity
  3.     expose :id, documentation: { type: 'Integer', desc: 'proxy iden' }
  4.     expose :ip, documentation: { type: 'inet', desc: 'IP address' }
  5.     expose :port, documentation: { type: 'Integer', desc: 'port' }
  6.     expose :username, documentation: { type: 'String', desc: 'username' }
  7.     expose :password, documentation: { type: 'String', desc: 'password' }
  8.     expose :country, documentation: { type: 'String', desc: 'country in ISO 3166' }
  9.     expose :source, documentation: { type: 'String', desc: 'source' }
  10.     expose :project, documentation: { type: 'String', desc: 'project where proxy is using'}
  11.     expose :speed_average, documentation: { type: 'String', desc: 'average data rate' }
  12.     expose :status, documentation: { type: 'String', desc: 'status' }
  13.     expose :errors,
  14.            documentation: { type: 'Array', desc: 'errors, e.g. validations error' },
  15.            unless: Proc.new { |proxy| proxy.errors.empty? } { |proxy| proxy.errors.messages }
  16.   end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement