Class: Io::Flow::V0::Models::Attachment

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Attachment

Returns a new instance of Attachment.



30668
30669
30670
30671
30672
30673
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30668

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:type, :url], 'Attachment')
  @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::StatementAttachmentType) ? x : ::Io::Flow::V0::Models::StatementAttachmentType.apply(x))
  @url = HttpClient::Preconditions.assert_class('url', opts.delete(:url), String)
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



30666
30667
30668
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30666

def type
  @type
end

#urlObject (readonly)

Returns the value of attribute url.



30666
30667
30668
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30666

def url
  @url
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30679
30680
30681
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30679

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

#to_hashObject



30683
30684
30685
30686
30687
30688
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30683

def to_hash
  {
    :type => type.value,
    :url => url
  }
end

#to_jsonObject



30675
30676
30677
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30675

def to_json
  JSON.dump(to_hash)
end