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.



17528
17529
17530
17531
17532
17533
17534
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17528

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

Instance Attribute Details

#environment ⇒ Object (readonly)

Returns the value of attribute environment.



17526
17527
17528
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17526

def environment
  @environment
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



17526
17527
17528
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17526

def id
  @id
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



17526
17527
17528
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17526

def name
  @name
end

#parent_id ⇒ Object (readonly)

Returns the value of attribute parent_id.



17526
17527
17528
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17526

def parent_id
  @parent_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17540
17541
17542
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17540

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

#to_hash ⇒ Object



17544
17545
17546
17547
17548
17549
17550
17551
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17544

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

#to_json ⇒ Object



17536
17537
17538
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17536

def to_json
  JSON.dump(to_hash)
end