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

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ OrganizationTokenReference

Returns a new instance of OrganizationTokenReference.



42016
42017
42018
42019
42020
42021
42022
42023
42024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42016

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

#environmentObject (readonly)

Returns the value of attribute environment.



42014
42015
42016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42014

def environment
  @environment
end

#idObject (readonly)

Returns the value of attribute id.



42014
42015
42016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42014

def id
  @id
end

#organizationObject (readonly)

Returns the value of attribute organization.



42014
42015
42016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42014

def organization
  @organization
end

#userObject (readonly)

Returns the value of attribute user.



42014
42015
42016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42014

def user
  @user
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



42030
42031
42032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42030

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

#subtype_to_hashObject



42034
42035
42036
42037
42038
42039
42040
42041
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42034

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

#to_jsonObject



42026
42027
42028
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42026

def to_json
  JSON.dump(to_hash)
end