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.



42345
42346
42347
42348
42349
42350
42351
42352
42353
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42345

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.



42343
42344
42345
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42343

def defaults
  @defaults
end

#environmentObject (readonly)

Returns the value of attribute environment.



42343
42344
42345
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42343

def environment
  @environment
end

#idObject (readonly)

Returns the value of attribute id.



42343
42344
42345
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42343

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



42343
42344
42345
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42343

def name
  @name
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.



42343
42344
42345
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42343

def parent_id
  @parent_id
end

#statusObject (readonly)

Returns the value of attribute status.



42343
42344
42345
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42343

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



42359
42360
42361
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42359

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

#to_hashObject



42363
42364
42365
42366
42367
42368
42369
42370
42371
42372
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42363

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



42355
42356
42357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42355

def to_json
  JSON.dump(to_hash)
end