Class: Io::Flow::V0::Models::OrganizationForm

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

Overview

Either id or name is required.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrganizationForm

Returns a new instance of OrganizationForm.



42931
42932
42933
42934
42935
42936
42937
42938
42939
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42931

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @id = (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, String))
  @name = (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, String))
  @environment = (x = (x = opts.delete(:environment); x.nil? ? "production" : x); x.is_a?(::Io::Flow::V0::Models::Environment) ? x : ::Io::Flow::V0::Models::Environment.apply(x))
  @parent_id = (x = opts.delete(:parent_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('parent_id', x, String))
  @defaults = (x = opts.delete(:defaults); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrganizationDefaults) ? x : ::Io::Flow::V0::Models::OrganizationDefaults.new(x)))
  @status = (x = (x = opts.delete(:status); x.nil? ? "active" : x); x.is_a?(::Io::Flow::V0::Models::OrganizationStatus) ? x : ::Io::Flow::V0::Models::OrganizationStatus.apply(x))
end

Instance Attribute Details

#defaultsObject (readonly)

Returns the value of attribute defaults.



42929
42930
42931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42929

def defaults
  @defaults
end

#environmentObject (readonly)

Returns the value of attribute environment.



42929
42930
42931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42929

def environment
  @environment
end

#idObject (readonly)

Returns the value of attribute id.



42929
42930
42931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42929

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



42929
42930
42931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42929

def name
  @name
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.



42929
42930
42931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42929

def parent_id
  @parent_id
end

#statusObject (readonly)

Returns the value of attribute status.



42929
42930
42931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42929

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



42945
42946
42947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42945

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

#to_hashObject



42949
42950
42951
42952
42953
42954
42955
42956
42957
42958
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42949

def to_hash
  {
    :id => id,
    :name => name,
    :environment => environment.value,
    :parent_id => parent_id,
    :defaults => defaults.nil? ? nil : defaults.to_hash,
    :status => status.value
  }
end

#to_jsonObject



42941
42942
42943
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42941

def to_json
  JSON.dump(to_hash)
end