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
-
#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.
21220 21221 21222 21223 21224 21225 21226 21227 21228 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21220 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))) end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
21218 21219 21220 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21218 def environment @environment end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
21218 21219 21220 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21218 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
21218 21219 21220 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21218 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
21218 21219 21220 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21218 def parent @parent end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
21234 21235 21236 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21234 def copy(incoming={}) Organization.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
21238 21239 21240 21241 21242 21243 21244 21245 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21238 def subtype_to_hash { :id => id, :name => name, :environment => environment.value, :parent => parent.nil? ? nil : parent.to_hash } end |
#to_json ⇒ Object
21230 21231 21232 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21230 def to_json JSON.dump(to_hash) end |