Class: FMS::Client
- Inherits:
-
Object
- Object
- FMS::Client
- Defined in:
- lib/fms/client.rb
Instance Attribute Summary collapse
-
#base_params ⇒ Object
readonly
Returns the value of attribute base_params.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #method_missing(meth, *args) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/fms/client.rb', line 10 def initialize( = {}) raise ArgumentError, ":host option is required" unless .include? :host defaults = {:auser => 'fms', :apswd => 'fms', :port => 1111} defaults.update() @host = defaults[:host] @port = defaults[:port] @base_params = {:auser => defaults[:auser], :apswd => defaults[:apswd]} @timeout = [:timeout] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/fms/client.rb', line 22 def method_missing(meth, *args) meth = ActiveSupport::Inflector.camelize(meth.to_s, false) if args.length == 1 params = args[0] else params = {} end Response.new do_get(meth, camelize_params(params)).strip end |
Instance Attribute Details
#base_params ⇒ Object (readonly)
Returns the value of attribute base_params.
8 9 10 |
# File 'lib/fms/client.rb', line 8 def base_params @base_params end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
8 9 10 |
# File 'lib/fms/client.rb', line 8 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
8 9 10 |
# File 'lib/fms/client.rb', line 8 def port @port end |