Class: Io::Flow::V0::Models::ActionRedirect

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

Overview

Redirect the customer to another url using a ‘window.open` or an HTML form POST redirection. After the payment process is completed, the customer will be redirected back to the `returnUrl` provided in the payment request.

Instance Attribute Summary collapse

Attributes inherited from Action

#type

Instance Method Summary collapse

Methods inherited from Action

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ActionRedirect

Returns a new instance of ActionRedirect.



25405
25406
25407
25408
25409
25410
25411
25412
25413
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25405

def initialize(incoming={})
  super(:type => Action::Types::ACTION_REDIRECT)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:method, :url], 'ActionRedirect')
  @expires_at = (x = opts.delete(:expires_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('expires_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @method = HttpClient::Preconditions.assert_class('method', opts.delete(:method), String)
  @url = HttpClient::Preconditions.assert_class('url', opts.delete(:url), String)
  @data = (x = opts.delete(:data); x.nil? ? nil : HttpClient::Preconditions.assert_class('data', HttpClient::Helper.to_object(x), Hash))
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



25403
25404
25405
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25403

def data
  @data
end

#expires_atObject (readonly)

Returns the value of attribute expires_at.



25403
25404
25405
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25403

def expires_at
  @expires_at
end

#methodObject (readonly)

Returns the value of attribute method.



25403
25404
25405
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25403

def method
  @method
end

#urlObject (readonly)

Returns the value of attribute url.



25403
25404
25405
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25403

def url
  @url
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



25419
25420
25421
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25419

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

#subtype_to_hashObject



25423
25424
25425
25426
25427
25428
25429
25430
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25423

def subtype_to_hash
  {
    :expires_at => expires_at,
    :method => method,
    :url => url,
    :data => data
  }
end

#to_jsonObject



25415
25416
25417
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25415

def to_json
  JSON.dump(to_hash)
end