Class: Kobana::Resources::Financial::StatementTransactionsImport

Inherits:
Base
  • Object
show all
Defined in:
lib/kobana/resources/financial/statement_transactions_import.rb

Constant Summary

Constants included from Connection

Connection::BASE_URI

Instance Attribute Summary

Attributes inherited from Base

#attributes, #errors

Class Method Summary collapse

Methods inherited from Base

#[], #client, #created?, infer_resource_endpoint, inherited, #initialize, interpolate, #method_missing, #new_record?, #primary_key, #request, #respond_to_missing?, #updated?, uri, #uri, #valid?, with_client

Methods included from Operations

#delete, #find_command, #handle_error_response, included, #list_commands, #save, #update

Methods included from Connection

included

Constructor Details

This class inherits a constructor from Kobana::Resources::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Kobana::Resources::Base

Class Method Details

.create(attributes = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/kobana/resources/financial/statement_transactions_import.rb', line 9

def self.create(attributes = {})
  require "faraday/multipart"

  if attributes[:source].is_a?(String) && File.exist?(attributes[:source])
    attributes[:source] = Faraday::UploadIO.new(
      attributes[:source],
      attributes.delete(:source_mime_type) || "application/octet-stream",
      attributes.delete(:source_filename) || File.basename(attributes[:source])
    )
  end
  super(attributes, multipart: true)
end