Class: Comptaline::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/comptaline/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
# File 'lib/comptaline/client.rb', line 7

def initialize(configuration)
  @host_url = configuration.host_url
  @username = configuration.username
  @password = configuration.password
end

Instance Attribute Details

#host_urlObject

Returns the value of attribute host_url.



5
6
7
# File 'lib/comptaline/client.rb', line 5

def host_url
  @host_url
end

#passwordObject

Returns the value of attribute password.



5
6
7
# File 'lib/comptaline/client.rb', line 5

def password
  @password
end

#usernameObject

Returns the value of attribute username.



5
6
7
# File 'lib/comptaline/client.rb', line 5

def username
  @username
end

Instance Method Details

#send(csv) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/comptaline/client.rb', line 13

def send(csv)
  file = make_file_for_multipart(csv)
  begin
    authenticated_request(:post, "OPERATIONS", { choice: "CSV" }, { fileName: file})
  ensure
    File.unlink(file.path)
  end
end