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.



55009
55010
55011
55012
55013
55014
55015
55016
55017
55018
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55009

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))
  @type = (x = opts.delete(:type); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrganizationType) ? x : ::Io::Flow::V0::Models::OrganizationType.apply(x)))
end

Instance Attribute Details

#defaultsObject (readonly)

Returns the value of attribute defaults.



55007
55008
55009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55007

def defaults
  @defaults
end

#environmentObject (readonly)

Returns the value of attribute environment.



55007
55008
55009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55007

def environment
  @environment
end

#idObject (readonly)

Returns the value of attribute id.



55007
55008
55009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55007

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



55007
55008
55009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55007

def name
  @name
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.



55007
55008
55009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55007

def parent_id
  @parent_id
end

#statusObject (readonly)

Returns the value of attribute status.



55007
55008
55009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55007

def status
  @status
end

#typeObject (readonly)

Returns the value of attribute type.



55007
55008
55009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55007

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



55024
55025
55026
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55024

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

#to_hashObject



55028
55029
55030
55031
55032
55033
55034
55035
55036
55037
55038
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55028

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

#to_jsonObject



55020
55021
55022
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55020

def to_json
  JSON.dump(to_hash)
end