Class: Io::Flow::V0::Models::OrganizationTokenForm

Inherits:
TokenForm
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Used to create a new token. User making the request must be authorized to create a token for this organization.

Instance Attribute Summary collapse

Attributes inherited from TokenForm

#discriminator

Instance Method Summary collapse

Methods inherited from TokenForm

#to_hash

Constructor Details

#initialize(incoming = {}) ⇒ OrganizationTokenForm

Returns a new instance of OrganizationTokenForm.



17749
17750
17751
17752
17753
17754
17755
17756
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17749

def initialize(incoming={})
  super(:discriminator => TokenForm::Types::ORGANIZATION_TOKEN_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:organization, :environment], 'OrganizationTokenForm')
  @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
  @environment = (x = opts.delete(:environment); x.is_a?(::Io::Flow::V0::Models::Environment) ? x : ::Io::Flow::V0::Models::Environment.apply(x))
  @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
end

Instance Attribute Details

#description ⇒ Object (readonly)

Returns the value of attribute description.



17747
17748
17749
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17747

def description
  @description
end

#environment ⇒ Object (readonly)

Returns the value of attribute environment.



17747
17748
17749
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17747

def environment
  @environment
end

#organization ⇒ Object (readonly)

Returns the value of attribute organization.



17747
17748
17749
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17747

def organization
  @organization
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17762
17763
17764
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17762

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

#subtype_to_hash ⇒ Object



17766
17767
17768
17769
17770
17771
17772
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17766

def subtype_to_hash
  {
    :organization => organization,
    :environment => environment.value,
    :description => description
  }
end

#to_json ⇒ Object



17758
17759
17760
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17758

def to_json
  JSON.dump(to_hash)
end