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.
-
#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.
9605 9606 9607 9608 9609 9610 9611 9612 9613 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9605 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) @options = (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))) end |
Instance Attribute Details
#intent ⇒ Object (readonly)
Returns the value of attribute intent.
9603 9604 9605 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9603 def intent @intent end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
9603 9604 9605 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9603 def key @key end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
9603 9604 9605 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9603 def label @label end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9603 9604 9605 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9603 def @options end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9603 9604 9605 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9603 def type @type end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
9619 9620 9621 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9619 def copy(incoming={}) AttributeForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
9623 9624 9625 9626 9627 9628 9629 9630 9631 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9623 def to_hash { :key => key, :options => .to_hash, :label => label, :intent => intent.nil? ? nil : intent.value, :type => type.nil? ? nil : type.value } end |
#to_json ⇒ Object
9615 9616 9617 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9615 def to_json JSON.dump(to_hash) end |