Class: Io::Flow::V0::Models::ChannelTokenReference

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

Instance Attribute Summary collapse

Attributes inherited from TokenReference

#discriminator

Instance Method Summary collapse

Methods inherited from TokenReference

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ChannelTokenReference

Returns a new instance of ChannelTokenReference.



35613
35614
35615
35616
35617
35618
35619
35620
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35613

def initialize(incoming={})
  super(:discriminator => TokenReference::Types::CHANNEL_TOKEN_REFERENCE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :channel, :user], 'ChannelTokenReference')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @channel = (x = opts.delete(:channel); x.is_a?(::Io::Flow::V0::Models::ChannelReference) ? x : ::Io::Flow::V0::Models::ChannelReference.new(x))
  @user = (x = opts.delete(:user); x.is_a?(::Io::Flow::V0::Models::UserReference) ? x : ::Io::Flow::V0::Models::UserReference.new(x))
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



35611
35612
35613
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35611

def channel
  @channel
end

#idObject (readonly)

Returns the value of attribute id.



35611
35612
35613
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35611

def id
  @id
end

#userObject (readonly)

Returns the value of attribute user.



35611
35612
35613
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35611

def user
  @user
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



35626
35627
35628
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35626

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

#subtype_to_hashObject



35630
35631
35632
35633
35634
35635
35636
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35630

def subtype_to_hash
  {
    :id => id,
    :channel => channel.to_hash,
    :user => user.to_hash
  }
end

#to_jsonObject



35622
35623
35624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35622

def to_json
  JSON.dump(to_hash)
end