Class: DopisOnlineClient::StatusRequest

Inherits:
Object
  • Object
show all
Includes:
HTTMultiParty
Defined in:
lib/dopis_online_client/status_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ StatusRequest

Returns a new instance of StatusRequest.



8
9
10
11
12
13
# File 'lib/dopis_online_client/status_request.rb', line 8

def initialize(params)
  @format = params[:format] || :xml
  @tracking_number = params[:tracking_number]
  @date = params[:date]
  self.class.base_uri DopisOnlineClient.base_uri
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



6
7
8
# File 'lib/dopis_online_client/status_request.rb', line 6

def color
  @color
end

#passwordObject (readonly)

Returns the value of attribute password.



6
7
8
# File 'lib/dopis_online_client/status_request.rb', line 6

def password
  @password
end

#payment_typeObject (readonly)

Returns the value of attribute payment_type.



6
7
8
# File 'lib/dopis_online_client/status_request.rb', line 6

def payment_type
  @payment_type
end

#pdf_fileObject (readonly)

Returns the value of attribute pdf_file.



6
7
8
# File 'lib/dopis_online_client/status_request.rb', line 6

def pdf_file
  @pdf_file
end

#postage_typeObject (readonly)

Returns the value of attribute postage_type.



6
7
8
# File 'lib/dopis_online_client/status_request.rb', line 6

def postage_type
  @postage_type
end

#response_formatObject (readonly)

Returns the value of attribute response_format.



6
7
8
# File 'lib/dopis_online_client/status_request.rb', line 6

def response_format
  @response_format
end

#usernameObject (readonly)

Returns the value of attribute username.



6
7
8
# File 'lib/dopis_online_client/status_request.rb', line 6

def username
  @username
end

Instance Method Details

#deliverObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/dopis_online_client/status_request.rb', line 15

def deliver
  response = self.class.post '/eprehledZak.php', :query => {
    :user => DopisOnlineClient.username,
    :passwd => DopisOnlineClient.password,
    :typvystupu => @format,
    :zasilka => @tracking_number,
    :datum => @date
  }
  response.body
end