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.



6069
6070
6071
6072
6073
6074
6075
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6069

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.



6067
6068
6069
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6067

def key
  @key
end

#labelObject (readonly)

Returns the value of attribute label.



6067
6068
6069
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6067

def label
  @label
end

#optionsObject (readonly)

Returns the value of attribute options.



6067
6068
6069
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6067

def options
  @options
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



6081
6082
6083
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6081

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

#to_hashObject



6085
6086
6087
6088
6089
6090
6091
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6085

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

#to_jsonObject



6077
6078
6079
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6077

def to_json
  JSON.dump(to_hash)
end