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

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ PartnerTokenReference

Returns a new instance of PartnerTokenReference.



23314
23315
23316
23317
23318
23319
23320
23321
23322
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23314

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

#environmentObject (readonly)

Returns the value of attribute environment.



23312
23313
23314
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23312

def environment
  @environment
end

#idObject (readonly)

Returns the value of attribute id.



23312
23313
23314
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23312

def id
  @id
end

#partnerObject (readonly)

Returns the value of attribute partner.



23312
23313
23314
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23312

def partner
  @partner
end

#userObject (readonly)

Returns the value of attribute user.



23312
23313
23314
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23312

def user
  @user
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23328
23329
23330
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23328

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

#subtype_to_hashObject



23332
23333
23334
23335
23336
23337
23338
23339
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23332

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

#to_jsonObject



23324
23325
23326
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23324

def to_json
  JSON.dump(to_hash)
end