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



39702
39703
39704
39705
39706
39707
39708
39709
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39702

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)))
end

Instance Attribute Details

#defaultsObject (readonly)

Returns the value of attribute defaults.



39700
39701
39702
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39700

def defaults
  @defaults
end

#environmentObject (readonly)

Returns the value of attribute environment.



39700
39701
39702
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39700

def environment
  @environment
end

#idObject (readonly)

Returns the value of attribute id.



39700
39701
39702
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39700

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



39700
39701
39702
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39700

def name
  @name
end

#parent_idObject (readonly)

Returns the value of attribute parent_id.



39700
39701
39702
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39700

def parent_id
  @parent_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



39715
39716
39717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39715

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

#to_hashObject



39719
39720
39721
39722
39723
39724
39725
39726
39727
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39719

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

#to_jsonObject



39711
39712
39713
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39711

def to_json
  JSON.dump(to_hash)
end