Class: Io::Flow::V0::Models::ChannelOrganization

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ChannelOrganization

Returns a new instance of ChannelOrganization.



35066
35067
35068
35069
35070
35071
35072
35073
35074
35075
35076
35077
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35066

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :organization, :key, :channel, :name, :defaults], 'ChannelOrganization')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @organization = (x = opts.delete(:organization); x.is_a?(::Io::Flow::V0::Models::OrganizationReference) ? x : ::Io::Flow::V0::Models::OrganizationReference.new(x))
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @channel = (x = opts.delete(:channel); x.is_a?(::Io::Flow::V0::Models::ChannelReference) ? x : ::Io::Flow::V0::Models::ChannelReference.new(x))
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @slug = (x = opts.delete(:slug); x.nil? ? nil : HttpClient::Preconditions.assert_class('slug', x, String))
  @defaults = (x = opts.delete(:defaults); x.is_a?(::Io::Flow::V0::Models::OrganizationDefaults) ? x : ::Io::Flow::V0::Models::OrganizationDefaults.new(x))
  @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



35064
35065
35066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35064

def attributes
  @attributes
end

#channelObject (readonly)

Returns the value of attribute channel.



35064
35065
35066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35064

def channel
  @channel
end

#defaultsObject (readonly)

Returns the value of attribute defaults.



35064
35065
35066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35064

def defaults
  @defaults
end

#idObject (readonly)

Returns the value of attribute id.



35064
35065
35066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35064

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



35064
35065
35066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35064

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



35064
35065
35066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35064

def name
  @name
end

#organizationObject (readonly)

Returns the value of attribute organization.



35064
35065
35066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35064

def organization
  @organization
end

#slugObject (readonly)

Returns the value of attribute slug.



35064
35065
35066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35064

def slug
  @slug
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



35083
35084
35085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35083

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

#to_hashObject



35087
35088
35089
35090
35091
35092
35093
35094
35095
35096
35097
35098
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35087

def to_hash
  {
    :id => id,
    :organization => organization.to_hash,
    :key => key,
    :channel => channel.to_hash,
    :name => name,
    :slug => slug,
    :defaults => defaults.to_hash,
    :attributes => attributes.nil? ? nil : attributes
  }
end

#to_jsonObject



35079
35080
35081
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35079

def to_json
  JSON.dump(to_hash)
end