Class: Ragoon::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint, options) ⇒ Client

Returns a new instance of Client.



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

def initialize(endpoint, options)
  @endpoint = endpoint
  @options = options
end

Instance Attribute Details

#endpointObject (readonly)

Returns the value of attribute endpoint.



2
3
4
# File 'lib/ragoon/client.rb', line 2

def endpoint
  @endpoint
end

#responseObject (readonly)

Returns the value of attribute response.



2
3
4
# File 'lib/ragoon/client.rb', line 2

def response
  @response
end

Instance Method Details

#request(action_name, body_node) ⇒ Object

Raises:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ragoon/client.rb', line 9

def request(action_name, body_node)
  retry_count = @options[:retry].to_i

  retry_count.times do
    begin
      request_once(action_name, body_node)
      return
    rescue Ragoon::Error => e
      unless e.message.include?('指定された画面はアクセスできません。')
        raise e
      end
      sleep(0.5)
    end
  end
  raise Ragoon::Error.new("試行回数が#{retry_count}回を超えたので終了しました。")
end

#resetObject



30
31
32
# File 'lib/ragoon/client.rb', line 30

def reset
  @result_set = nil
end

#result_setObject



26
27
28
# File 'lib/ragoon/client.rb', line 26

def result_set
  @result_set ||= Nokogiri::XML.parse(response.body)
end