Class: Io::Flow::V0::Models::Organization

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

Overview

Represents a single organization in the system, and what environment it is currently operating in.

Instance Attribute Summary collapse

Attributes inherited from ExpandableOrganization

#discriminator

Instance Method Summary collapse

Methods inherited from ExpandableOrganization

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ Organization

Returns a new instance of Organization.



54610
54611
54612
54613
54614
54615
54616
54617
54618
54619
54620
54621
54622
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54610

def initialize(incoming={})
  super(:discriminator => ExpandableOrganization::Types::ORGANIZATION)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :name, :environment], 'Organization')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @environment = (x = opts.delete(:environment); x.is_a?(::Io::Flow::V0::Models::Environment) ? x : ::Io::Flow::V0::Models::Environment.apply(x))
  @parent = (x = opts.delete(:parent); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrganizationReference) ? x : ::Io::Flow::V0::Models::OrganizationReference.new(x)))
  @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)))
  @created_at = (x = opts.delete(:created_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @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

#created_atObject (readonly)

Returns the value of attribute created_at.



54608
54609
54610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54608

def created_at
  @created_at
end

#defaultsObject (readonly)

Returns the value of attribute defaults.



54608
54609
54610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54608

def defaults
  @defaults
end

#environmentObject (readonly)

Returns the value of attribute environment.



54608
54609
54610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54608

def environment
  @environment
end

#idObject (readonly)

Returns the value of attribute id.



54608
54609
54610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54608

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



54608
54609
54610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54608

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



54608
54609
54610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54608

def parent
  @parent
end

#statusObject (readonly)

Returns the value of attribute status.



54608
54609
54610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54608

def status
  @status
end

#typeObject (readonly)

Returns the value of attribute type.



54608
54609
54610
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54608

def type
  @type
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



54628
54629
54630
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54628

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

#subtype_to_hashObject



54632
54633
54634
54635
54636
54637
54638
54639
54640
54641
54642
54643
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54632

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

#to_jsonObject



54624
54625
54626
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 54624

def to_json
  JSON.dump(to_hash)
end