Class: Itexmo::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/itexmo/service.rb

Overview

service

Constant Summary collapse

API_ENDPOINT =
'https://www.itexmo.com/php_api'.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeService

Returns a new instance of Service.



11
12
13
# File 'lib/itexmo/service.rb', line 11

def initialize
  @api_code = Itexmo.configuration.api_code
end

Instance Attribute Details

#api_codeObject

Returns the value of attribute api_code.



7
8
9
# File 'lib/itexmo/service.rb', line 7

def api_code
  @api_code
end

Class Method Details

.apicode_infoObject



34
35
36
37
# File 'lib/itexmo/service.rb', line 34

def self.apicode_info
  instance = new
  instance.apicode_info
end

.statusObject



22
23
24
25
# File 'lib/itexmo/service.rb', line 22

def self.status
  instance = new
  instance.status
end

Instance Method Details

#apicode_infoObject



27
28
29
30
31
32
# File 'lib/itexmo/service.rb', line 27

def apicode_info
  uri = URI(API_ENDPOINT + '/apicode_info.php')
  uri.query = URI.encode_www_form(parameters)
  request = Net::HTTP.get_response(uri)
  ResponseHelper.parse(request.body)
end

#statusObject



15
16
17
18
19
20
# File 'lib/itexmo/service.rb', line 15

def status
  uri = URI(API_ENDPOINT + '/serverstatus.php')
  uri.query = URI.encode_www_form(parameters)
  request = Net::HTTP.get_response(uri)
  ResponseHelper.parse(request.body)
end