Class: ShafClient::Form
- Inherits:
-
Resource
- Object
- BaseResource
- Resource
- ShafClient::Form
- Defined in:
- lib/shaf_client/form.rb
Instance Attribute Summary
Attributes inherited from BaseResource
#attributes, #curies, #embedded_resources, #links
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #http_method ⇒ Object
-
#submit ⇒ Object
def validate; end.
- #target ⇒ Object
- #values ⇒ Object
Methods inherited from Resource
Methods inherited from BaseResource
#actions, #attribute, #curie, #embedded, #initialize, #link, #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
#[](key) ⇒ Object
15 16 17 |
# File 'lib/shaf_client/form.rb', line 15 def [](key) values[key] end |
#[]=(key, value) ⇒ Object
19 20 21 |
# File 'lib/shaf_client/form.rb', line 19 def []=(key, value) values[key] = value end |
#http_method ⇒ Object
27 28 29 |
# File 'lib/shaf_client/form.rb', line 27 def http_method attribute(:method).downcase.to_sym end |
#submit ⇒ Object
def validate; end
33 34 35 |
# File 'lib/shaf_client/form.rb', line 33 def submit client.send(http_method, target, @values) end |
#target ⇒ Object
23 24 25 |
# File 'lib/shaf_client/form.rb', line 23 def target attribute(:href) end |
#values ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/shaf_client/form.rb', line 7 def values return @values if defined? @values @values = attribute(:fields).each_with_object({}) do |d, v| v[d['name'].to_sym] = d['value'] end end |