class Io::Flow::V0::Models::Attribute
An attribute can be configured to be used in different ways throughout Flow
. A common example is to identify a meaningful attribute (e.g. brand) that can then be displayed throughout the Flow
console.
Attributes
id[R]
intent[R]
key[R]
label[R]
options[R]
position[R]
type[R]
Public Class Methods
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 30699 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key, :options], 'Attribute') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @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))) @position = (x = opts.delete(:position); x.nil? ? nil : HttpClient::Preconditions.assert_class('position', x, Integer)) end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 30715 def copy(incoming={}) Attribute.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 30719 def to_hash { :id => id, :key => key, :options => options.to_hash, :label => label, :intent => intent.nil? ? nil : intent.value, :type => type.nil? ? nil : type.value, :position => position } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 30711 def to_json JSON.dump(to_hash) end