Class: Io::Flow::V0::Models::ActionExecuteScript

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

Overview

Render the returned HTML script from the payment provider, which will gather browser data to inform the authorization decision. After several seconds, the payment request will asynchronously update based on the results of the script.

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

Returns a new instance of ActionExecuteScript.



26918
26919
26920
26921
26922
26923
26924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26918

def initialize(incoming={})
  super(:type => Action::Types::ACTION_EXECUTE_SCRIPT)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:script], 'ActionExecuteScript')
  @expires_at = (x = opts.delete(:expires_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('expires_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @script = HttpClient::Preconditions.assert_class('script', opts.delete(:script), String)
end

Instance Attribute Details

#expires_atObject (readonly)

Returns the value of attribute expires_at.



26916
26917
26918
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26916

def expires_at
  @expires_at
end

#scriptObject (readonly)

Returns the value of attribute script.



26916
26917
26918
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26916

def script
  @script
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26930
26931
26932
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26930

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

#subtype_to_hashObject



26934
26935
26936
26937
26938
26939
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26934

def subtype_to_hash
  {
    :expires_at => expires_at,
    :script => script
  }
end

#to_jsonObject



26926
26927
26928
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26926

def to_json
  JSON.dump(to_hash)
end