Class: ShafClient::ShafForm

Inherits:
Form show all
Defined in:
lib/shaf_client/shaf_form.rb

Constant Summary

Constants included from MimeTypes

MimeTypes::DEFAULT_ADAPTER, MimeTypes::MIME_TYPE_HAL, MimeTypes::MIME_TYPE_JSON

Instance Attribute Summary

Attributes inherited from Resource

#headers, #http_status

Attributes inherited from BaseResource

#attributes, #curies, #embedded_resources, #links

Instance Method Summary collapse

Methods inherited from Form

#[], #[]=, #submit, #valid?, #values

Methods inherited from Resource

build, content_type, #destroy!, #get, #get_doc, #get_hal_form, #initialize, #inspect, profile, #reload!

Methods inherited from BaseResource

#[], #actions, #attribute, #curie, #embedded, #initialize, #inspect, #link, #rel?, #to_h, #to_s

Constructor Details

This class inherits a constructor from ShafClient::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ShafClient::BaseResource

Instance Method Details

#content_typeObject



24
25
26
# File 'lib/shaf_client/shaf_form.rb', line 24

def content_type
  attribute(:type)
end

#fieldsObject



28
29
30
31
32
# File 'lib/shaf_client/shaf_form.rb', line 28

def fields
  attribute(:fields).map do |values|
    Field.new(values.transform_keys(&:to_sym))
  end
end

#http_methodObject



20
21
22
# File 'lib/shaf_client/shaf_form.rb', line 20

def http_method
  attribute(:method).downcase.to_sym
end

#nameObject



12
13
14
# File 'lib/shaf_client/shaf_form.rb', line 12

def name
  attribute(:name)
end

#targetObject



16
17
18
# File 'lib/shaf_client/shaf_form.rb', line 16

def target
  attribute(:href)
end

#titleObject



8
9
10
# File 'lib/shaf_client/shaf_form.rb', line 8

def title
  attribute(:title)
end