Class: Io::Flow::V0::Models::Organization
- Inherits:
-
ExpandableOrganization
- Object
- ExpandableOrganization
- Io::Flow::V0::Models::Organization
- 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
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#defaults ⇒ Object
readonly
Returns the value of attribute defaults.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Attributes inherited from ExpandableOrganization
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Organization
constructor
A new instance of Organization.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from ExpandableOrganization
Constructor Details
#initialize(incoming = {}) ⇒ Organization
Returns a new instance of Organization.
50737 50738 50739 50740 50741 50742 50743 50744 50745 50746 50747 50748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50737 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)) end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
50735 50736 50737 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50735 def created_at @created_at end |
#defaults ⇒ Object (readonly)
Returns the value of attribute defaults.
50735 50736 50737 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50735 def defaults @defaults end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
50735 50736 50737 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50735 def environment @environment end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
50735 50736 50737 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50735 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
50735 50736 50737 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50735 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
50735 50736 50737 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50735 def parent @parent end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
50735 50736 50737 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50735 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
50754 50755 50756 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50754 def copy(incoming={}) Organization.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
50758 50759 50760 50761 50762 50763 50764 50765 50766 50767 50768 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50758 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 } end |
#to_json ⇒ Object
50750 50751 50752 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50750 def to_json JSON.dump(to_hash) end |