module RopenPi::Type

Public Class Methods

bool_type(opts = { example: true }) click to toggle source
# File lib/ropen_pi/config_helper.rb, line 88
def self.bool_type(opts = { example: true })
  type('boolean', opts)
end
Also aliased as: boolean_type
boolean_type(opts = { example: true })
Alias for: bool_type
date_time_type(opts = { example: '2020-02-02' }) click to toggle source
# File lib/ropen_pi/config_helper.rb, line 68
def self.date_time_type(opts = { example: '2020-02-02' })
  string_type(opts).merge(format: 'date-time')
end
email_type(opts = { example: 'han.solo@example.com' }) click to toggle source
# File lib/ropen_pi/config_helper.rb, line 72
def self.email_type(opts = { example: 'han.solo@example.com' })
  string_type(opts).merge(format: 'email')
end
int_type(opts = { example: 1 })
Alias for: integer_type
integer_type(opts = { example: 1 }) click to toggle source
# File lib/ropen_pi/config_helper.rb, line 84
def self.integer_type(opts = { example: 1 })
  type('integer', opts)
end
Also aliased as: int_type
ref_type(ref) click to toggle source
# File lib/ropen_pi/config_helper.rb, line 103
def self.ref_type(ref)
  { '$ref': ref }
end
string_array_type(opts = {}) click to toggle source
# File lib/ropen_pi/config_helper.rb, line 96
def self.string_array_type(opts = {})
  {
    type: 'array',
    items: { type: 'string', example: 'Example string' }
   }.merge(opts)
end
string_type(opts = { example: 'Example string' }) click to toggle source
# File lib/ropen_pi/config_helper.rb, line 80
def self.string_type(opts = { example: 'Example string' })
  type('string', opts)
end
type(thing, opts = {}) click to toggle source
# File lib/ropen_pi/config_helper.rb, line 92
def self.type(thing, opts = {})
  { type: thing }.merge(opts)
end
uuid_type(opts = { example: 'abcd12-1234ab-abcdef123' }) click to toggle source
# File lib/ropen_pi/config_helper.rb, line 76
def self.uuid_type(opts = { example: 'abcd12-1234ab-abcdef123' })
  string_type(opts).merge(format: 'uuid')
end