class ShafClient::HalForm

Attributes

target[RW]

Public Instance Methods

content_type() click to toggle source
# File lib/shaf_client/hal_form.rb, line 21
def content_type
  template[:contentType] || 'application/json'
end
fields() click to toggle source
# File lib/shaf_client/hal_form.rb, line 25
def fields
  template[:properties].map do |values|
    Field.new(**values.transform_keys(&:to_sym))
  end
end
http_method() click to toggle source
# File lib/shaf_client/hal_form.rb, line 17
def http_method
  template[:method].downcase.to_sym
end
name() click to toggle source
# File lib/shaf_client/hal_form.rb, line 13
def name
  attribute(:name)
end
title() click to toggle source
# File lib/shaf_client/hal_form.rb, line 9
def title
  template[:title]
end

Private Instance Methods

template() click to toggle source
# File lib/shaf_client/hal_form.rb, line 33
def template
  @template ||= attributes
    .dig(:_templates, 'default')
    .transform_keys(&:to_sym)
end