Class: Io::Flow::V0::Models::PartnerTokenReference

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

Overview

Summary data for a given token

Instance Attribute Summary collapse

Attributes inherited from TokenReference

#discriminator

Instance Method Summary collapse

Methods inherited from TokenReference

#to_hash

Constructor Details

#initialize(incoming = {}) ⇒ PartnerTokenReference

Returns a new instance of PartnerTokenReference.



17992
17993
17994
17995
17996
17997
17998
17999
18000
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17992

def initialize(incoming={})
  super(:discriminator => TokenReference::Types::PARTNER_TOKEN_REFERENCE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :partner, :environment, :user], 'PartnerTokenReference')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @partner = (x = opts.delete(:partner); x.is_a?(::Io::Flow::V0::Models::TokenPartnerReference) ? x : ::Io::Flow::V0::Models::TokenPartnerReference.new(x))
  @environment = (x = opts.delete(:environment); x.is_a?(::Io::Flow::V0::Models::Environment) ? x : ::Io::Flow::V0::Models::Environment.apply(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

#environment ⇒ Object (readonly)

Returns the value of attribute environment.



17990
17991
17992
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17990

def environment
  @environment
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



17990
17991
17992
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17990

def id
  @id
end

#partner ⇒ Object (readonly)

Returns the value of attribute partner.



17990
17991
17992
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17990

def partner
  @partner
end

#user ⇒ Object (readonly)

Returns the value of attribute user.



17990
17991
17992
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17990

def user
  @user
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



18006
18007
18008
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18006

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

#subtype_to_hash ⇒ Object



18010
18011
18012
18013
18014
18015
18016
18017
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18010

def subtype_to_hash
  {
    :id => id,
    :partner => partner.to_hash,
    :environment => environment.value,
    :user => user.to_hash
  }
end

#to_json ⇒ Object



18002
18003
18004
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18002

def to_json
  JSON.dump(to_hash)
end