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.



29097
29098
29099
29100
29101
29102
29103
29104
29105
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29097

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.



29095
29096
29097
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29095

def data
  @data
end

#expires_atObject (readonly)

Returns the value of attribute expires_at.



29095
29096
29097
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29095

def expires_at
  @expires_at
end

#methodObject (readonly)

Returns the value of attribute method.



29095
29096
29097
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29095

def method
  @method
end

#urlObject (readonly)

Returns the value of attribute url.



29095
29096
29097
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29095

def url
  @url
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



29111
29112
29113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29111

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

#subtype_to_hashObject



29115
29116
29117
29118
29119
29120
29121
29122
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29115

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

#to_jsonObject



29107
29108
29109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29107

def to_json
  JSON.dump(to_hash)
end