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.



29065
29066
29067
29068
29069
29070
29071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29065

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.



29063
29064
29065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29063

def expires_at
  @expires_at
end

#scriptObject (readonly)

Returns the value of attribute script.



29063
29064
29065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29063

def script
  @script
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



29077
29078
29079
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29077

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

#subtype_to_hashObject



29081
29082
29083
29084
29085
29086
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29081

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

#to_jsonObject



29073
29074
29075
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29073

def to_json
  JSON.dump(to_hash)
end