Class: Io::Flow::V0::Models::AttributeForm

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ AttributeForm



14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14285

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)))
  @position = (x = opts.delete(:position); x.nil? ? nil : HttpClient::Preconditions.assert_class('position', x, Integer))
end

Instance Attribute Details

#intentObject (readonly)

Returns the value of attribute intent.



14283
14284
14285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14283

def intent
  @intent
end

#keyObject (readonly)

Returns the value of attribute key.



14283
14284
14285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14283

def key
  @key
end

#labelObject (readonly)

Returns the value of attribute label.



14283
14284
14285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14283

def label
  @label
end

#optionsObject (readonly)

Returns the value of attribute options.



14283
14284
14285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14283

def options
  @options
end

#positionObject (readonly)

Returns the value of attribute position.



14283
14284
14285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14283

def position
  @position
end

#typeObject (readonly)

Returns the value of attribute type.



14283
14284
14285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14283

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



14300
14301
14302
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14300

def copy(incoming={})
  AttributeForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14304

def to_hash
  {
    :key => key,
    :options => options.to_hash,
    :label => label,
    :intent => intent.nil? ? nil : intent.value,
    :type => type.nil? ? nil : type.value,
    :position => position
  }
end

#to_jsonObject



14296
14297
14298
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14296

def to_json
  JSON.dump(to_hash)
end