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



22087
22088
22089
22090
22091
22092
22093
22094
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22087

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.



22085
22086
22087
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22085

def description
  @description
end

#environmentObject (readonly)

Returns the value of attribute environment.



22085
22086
22087
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22085

def environment
  @environment
end

#organizationObject (readonly)

Returns the value of attribute organization.



22085
22086
22087
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22085

def organization
  @organization
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22100
22101
22102
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22100

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

#subtype_to_hashObject



22104
22105
22106
22107
22108
22109
22110
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22104

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

#to_jsonObject



22096
22097
22098
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22096

def to_json
  JSON.dump(to_hash)
end