Class: Ragoon::Client
- Inherits:
-
Object
- Object
- Ragoon::Client
- Defined in:
- lib/ragoon/client.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(endpoint, options) ⇒ Client
constructor
A new instance of Client.
- #request(action_name, body_node) ⇒ Object
- #reset ⇒ Object
- #result_set ⇒ Object
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, ) @endpoint = endpoint @options = end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
2 3 4 |
# File 'lib/ragoon/client.rb', line 2 def endpoint @endpoint end |
#response ⇒ Object (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
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..include?('指定された画面はアクセスできません。') raise e end sleep(0.5) end end raise Ragoon::Error.new("試行回数が#{retry_count}回を超えたので終了しました。") end |
#reset ⇒ Object
30 31 32 |
# File 'lib/ragoon/client.rb', line 30 def reset @result_set = nil end |
#result_set ⇒ Object
26 27 28 |
# File 'lib/ragoon/client.rb', line 26 def result_set @result_set ||= Nokogiri::XML.parse(response.body) end |