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.



32285
32286
32287
32288
32289
32290
32291
32292
32293
32294
32295
32296
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32285

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.



32283
32284
32285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32283

def attributes
  @attributes
end

#channelObject (readonly)

Returns the value of attribute channel.



32283
32284
32285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32283

def channel
  @channel
end

#defaultsObject (readonly)

Returns the value of attribute defaults.



32283
32284
32285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32283

def defaults
  @defaults
end

#idObject (readonly)

Returns the value of attribute id.



32283
32284
32285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32283

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



32283
32284
32285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32283

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



32283
32284
32285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32283

def name
  @name
end

#organizationObject (readonly)

Returns the value of attribute organization.



32283
32284
32285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32283

def organization
  @organization
end

#slugObject (readonly)

Returns the value of attribute slug.



32283
32284
32285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32283

def slug
  @slug
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32302
32303
32304
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32302

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

#to_hashObject



32306
32307
32308
32309
32310
32311
32312
32313
32314
32315
32316
32317
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32306

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



32298
32299
32300
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32298

def to_json
  JSON.dump(to_hash)
end