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

Returns a new instance of AttributeForm.



8101
8102
8103
8104
8105
8106
8107
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8101

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))
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



8099
8100
8101
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8099

def key
  @key
end

#labelObject (readonly)

Returns the value of attribute label.



8099
8100
8101
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8099

def label
  @label
end

#optionsObject (readonly)

Returns the value of attribute options.



8099
8100
8101
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8099

def options
  @options
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



8113
8114
8115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8113

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

#to_hashObject



8117
8118
8119
8120
8121
8122
8123
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8117

def to_hash
  {
    :key => key,
    :options => options.to_hash,
    :label => label
  }
end

#to_jsonObject



8109
8110
8111
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8109

def to_json
  JSON.dump(to_hash)
end