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

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ OrganizationTokenForm

Returns a new instance of OrganizationTokenForm.



20877
20878
20879
20880
20881
20882
20883
20884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20877

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

#descriptionObject (readonly)

Returns the value of attribute description.



20875
20876
20877
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20875

def description
  @description
end

#environmentObject (readonly)

Returns the value of attribute environment.



20875
20876
20877
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20875

def environment
  @environment
end

#organizationObject (readonly)

Returns the value of attribute organization.



20875
20876
20877
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20875

def organization
  @organization
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



20890
20891
20892
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20890

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

#subtype_to_hashObject



20894
20895
20896
20897
20898
20899
20900
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20894

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

#to_jsonObject



20886
20887
20888
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20886

def to_json
  JSON.dump(to_hash)
end