Class: Io::Flow::V0::Models::AttributeForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AttributeForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#intent ⇒ Object
readonly
Returns the value of attribute intent.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AttributeForm
constructor
A new instance of AttributeForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AttributeForm
Returns a new instance of AttributeForm.
14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14826 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:key, :options], 'AttributeForm') @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) = (x = opts.delete(:options); x.is_a?(::Io::Flow::V0::Models::Options) ? x : ::Io::Flow::V0::Models::Options.new(x)) @label = (x = opts.delete(:label); x.nil? ? nil : HttpClient::Preconditions.assert_class('label', x, String)) @intent = (x = opts.delete(:intent); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AttributeIntent) ? x : ::Io::Flow::V0::Models::AttributeIntent.apply(x))) @type = (x = opts.delete(:type); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AttributeDataType) ? x : ::Io::Flow::V0::Models::AttributeDataType.apply(x))) @position = (x = opts.delete(:position); x.nil? ? nil : HttpClient::Preconditions.assert_class('position', x, Integer)) end |
Instance Attribute Details
#intent ⇒ Object (readonly)
Returns the value of attribute intent.
14824 14825 14826 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14824 def intent @intent end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
14824 14825 14826 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14824 def key @key end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
14824 14825 14826 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14824 def label @label end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
14824 14825 14826 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14824 def end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
14824 14825 14826 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14824 def position @position end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
14824 14825 14826 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14824 def type @type end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
14841 14842 14843 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14841 def copy(incoming={}) AttributeForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14845 def to_hash { :key => key, :options => .to_hash, :label => label, :intent => intent.nil? ? nil : intent.value, :type => type.nil? ? nil : type.value, :position => position } end |
#to_json ⇒ Object
14837 14838 14839 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14837 def to_json JSON.dump(to_hash) end |