Class: Io::Flow::V0::Models::OrganizationTokenReference

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

Returns a new instance of OrganizationTokenReference.



17781
17782
17783
17784
17785
17786
17787
17788
17789
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17781

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



17779
17780
17781
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17779

def environment
  @environment
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



17779
17780
17781
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17779

def id
  @id
end

#organization ⇒ Object (readonly)

Returns the value of attribute organization.



17779
17780
17781
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17779

def organization
  @organization
end

#user ⇒ Object (readonly)

Returns the value of attribute user.



17779
17780
17781
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17779

def user
  @user
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17795
17796
17797
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17795

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

#subtype_to_hash ⇒ Object



17799
17800
17801
17802
17803
17804
17805
17806
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17799

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

#to_json ⇒ Object



17791
17792
17793
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17791

def to_json
  JSON.dump(to_hash)
end