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
-
#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.
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.
32816 32817 32818 32819 32820 32821 32822 32823 32824 32825 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32816 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))) end |
Instance Attribute Details
#defaults ⇒ Object (readonly)
Returns the value of attribute defaults.
32814 32815 32816 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32814 def defaults @defaults end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
32814 32815 32816 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32814 def environment @environment end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
32814 32815 32816 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32814 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
32814 32815 32816 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32814 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
32814 32815 32816 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32814 def parent @parent end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
32831 32832 32833 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32831 def copy(incoming={}) Organization.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
32835 32836 32837 32838 32839 32840 32841 32842 32843 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32835 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 } end |
#to_json ⇒ Object
32827 32828 32829 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32827 def to_json JSON.dump(to_hash) end |