Class: SterlingApi::Api

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

Instance Method Summary collapse

Constructor Details

#initialize(mode) ⇒ Api

mode: prod or test



91
92
93
94
95
# File 'lib/sterling_api.rb', line 91

def initialize(mode)
  @mode = mode
  # test system password is 'Password2' until changed
  self
end

Instance Method Details

#modeObject



97
98
99
# File 'lib/sterling_api.rb', line 97

def mode
  @mode.to_s =~ /prod/i ? :prod : :test
end

#order(background_check) ⇒ Object



101
102
103
104
105
106
107
# File 'lib/sterling_api.rb', line 101

def order(background_check)
  req = SterlingApi::RemoteActions::Request.new(
    :url => url(:order_one_step),
    :body => background_check.to_xml
  )
  req.send_request
end

#password_change_request(password_change) ⇒ Object



109
110
111
112
113
114
115
# File 'lib/sterling_api.rb', line 109

def password_change_request(password_change)
  req = SterlingApi::RemoteActions::Request.new(
    :url => url(:password_change),
    :body => password_change.to_xml
  )
  req.send_request
end

#url(type) ⇒ Object



117
118
119
# File 'lib/sterling_api.rb', line 117

def url(type)
  SterlingApi::URLS[mode][type][:url]
end