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

Instance Method Summary collapse

Methods inherited from TokenForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ PartnerTokenForm

Returns a new instance of PartnerTokenForm.



15596
15597
15598
15599
15600
15601
15602
15603
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15596

def initialize(incoming={})
  super(:name => 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.



15594
15595
15596
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15594

def description
  @description
end

#environmentObject (readonly)

Returns the value of attribute environment.



15594
15595
15596
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15594

def environment
  @environment
end

#partnerObject (readonly)

Returns the value of attribute partner.



15594
15595
15596
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15594

def partner
  @partner
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



15609
15610
15611
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15609

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

#subtype_to_hashObject



15613
15614
15615
15616
15617
15618
15619
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15613

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

#to_jsonObject



15605
15606
15607
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15605

def to_json
  JSON.dump(to_hash)
end