Class: Io::Flow::V0::Models::OrganizationTokenV2Reference

Inherits:
TokenReference
  • Object
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 = {}) ⇒ OrganizationTokenV2Reference

Returns a new instance of OrganizationTokenV2Reference.



51523
51524
51525
51526
51527
51528
51529
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51523

def initialize(incoming={})
  super(:discriminator => TokenReference::Types::ORGANIZATION_TOKEN_V2_REFERENCE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :organization], 'OrganizationTokenV2Reference')
  @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))
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



51521
51522
51523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51521

def id
  @id
end

#organizationObject (readonly)

Returns the value of attribute organization.



51521
51522
51523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51521

def organization
  @organization
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



51535
51536
51537
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51535

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

#subtype_to_hashObject



51539
51540
51541
51542
51543
51544
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51539

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

#to_jsonObject



51531
51532
51533
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51531

def to_json
  JSON.dump(to_hash)
end