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.



48976
48977
48978
48979
48980
48981
48982
48983
48984
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48976

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.



48974
48975
48976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48974

def defaults
  @defaults
end

#environmentObject (readonly)

Returns the value of attribute environment.



48974
48975
48976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48974

def environment
  @environment
end

#idObject (readonly)

Returns the value of attribute id.



48974
48975
48976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48974

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



48974
48975
48976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48974

def name
  @name
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.



48974
48975
48976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48974

def parent_id
  @parent_id
end

#statusObject (readonly)

Returns the value of attribute status.



48974
48975
48976
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48974

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



48990
48991
48992
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48990

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

#to_hashObject



48994
48995
48996
48997
48998
48999
49000
49001
49002
49003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48994

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



48986
48987
48988
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 48986

def to_json
  JSON.dump(to_hash)
end