Class: Io::Flow::V0::Models::PartnerTokenForm

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 partner.

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 = {}) ⇒ PartnerTokenForm

Returns a new instance of PartnerTokenForm.



18039
18040
18041
18042
18043
18044
18045
18046
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18039

def initialize(incoming={})
  super(:discriminator => TokenForm::Types::PARTNER_TOKEN_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:partner, :environment], 'PartnerTokenForm')
  @partner = HttpClient::Preconditions.assert_class('partner', opts.delete(:partner), 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.



18037
18038
18039
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18037

def description
  @description
end

#environmentObject (readonly)

Returns the value of attribute environment.



18037
18038
18039
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18037

def environment
  @environment
end

#partnerObject (readonly)

Returns the value of attribute partner.



18037
18038
18039
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18037

def partner
  @partner
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



18052
18053
18054
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18052

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

#subtype_to_hashObject



18056
18057
18058
18059
18060
18061
18062
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18056

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

#to_jsonObject



18048
18049
18050
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18048

def to_json
  JSON.dump(to_hash)
end