Class: Io::Flow::V0::Models::TransactionSource

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ TransactionSource

Returns a new instance of TransactionSource.



25897
25898
25899
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25897

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



25895
25896
25897
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25895

def value
  @value
end

Class Method Details

.adjustmentObject



25933
25934
25935
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25933

def TransactionSource.adjustment
  @@_adjustment ||= TransactionSource.new('adjustment')
end

.ALLObject



25917
25918
25919
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25917

def TransactionSource.ALL
  @@all ||= [TransactionSource.capture, TransactionSource.refund, TransactionSource.dispute, TransactionSource.adjustment, TransactionSource.shipping_label]
end

.apply(value) ⇒ Object

Returns the instance of TransactionSource for this value, creating a new instance for an unknown value



25902
25903
25904
25905
25906
25907
25908
25909
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25902

def TransactionSource.apply(value)
  if value.instance_of?(TransactionSource)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || TransactionSource.new(value))
  end
end

.captureObject



25921
25922
25923
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25921

def TransactionSource.capture
  @@_capture ||= TransactionSource.new('capture')
end

.disputeObject



25929
25930
25931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25929

def TransactionSource.dispute
  @@_dispute ||= TransactionSource.new('dispute')
end

.from_string(value) ⇒ Object

Returns the instance of TransactionSource for this value, or nil if not found



25912
25913
25914
25915
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25912

def TransactionSource.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  TransactionSource.ALL.find { |v| v.value == value }
end

.refundObject



25925
25926
25927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25925

def TransactionSource.refund
  @@_refund ||= TransactionSource.new('refund')
end

.shipping_labelObject



25937
25938
25939
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25937

def TransactionSource.shipping_label
  @@_shipping_label ||= TransactionSource.new('shipping_label')
end

Instance Method Details

#to_hashObject



25941
25942
25943
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25941

def to_hash
  value
end