Class: Io::Flow::V0::Models::ValidationForm

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

Overview

Defines the payload of a request to validate a token, with primary goal of preventing the token from being included in an HTTP GET.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ValidationForm

Returns a new instance of ValidationForm.



14928
14929
14930
14931
14932
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14928

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:token], 'ValidationForm')
  @token = HttpClient::Preconditions.assert_class('token', opts.delete(:token), String)
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



14926
14927
14928
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14926

def token
  @token
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



14938
14939
14940
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14938

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

#to_hashObject



14942
14943
14944
14945
14946
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14942

def to_hash
  {
    :token => token
  }
end

#to_jsonObject



14934
14935
14936
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14934

def to_json
  JSON.dump(to_hash)
end