Class: Lemonway::Client
- Inherits:
-
Object
- Object
- Lemonway::Client
- Defined in:
- lib/lemonway/client.rb
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#instance ⇒ Object
Returns the value of attribute instance.
Instance Method Summary collapse
-
#initialize(api_opts = {}, client_opts = {}, &block) ⇒ Client
constructor
A new instance of Client.
- #method_missing(method_name, *args, &block) ⇒ Object
- #operations ⇒ Object
Constructor Details
#initialize(api_opts = {}, client_opts = {}, &block) ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/lemonway/client.rb', line 12 def initialize api_opts={}, client_opts={}, &block [api_opts, client_opts].each(&:symbolize_keys!) @xml_mini_backend = client_opts.delete(:xml_mini_backend) || ActiveSupport::XmlMini_REXML @entity_expansion_text_limit = client_opts.delete(:entity_expansion_text_limit) || 10**20 @instance = Savon.client client_opts.update(wsdl: api_opts.delete(:wsdl)), &block @api_options = api_opts.camelize_keys.with_indifferent_access end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/lemonway/client.rb', line 27 def method_missing method_name, *args, &block if operations.include? method_name.to_sym client_call method_name, *args, &block else super end end |
Instance Attribute Details
#instance ⇒ Object
Returns the value of attribute instance.
10 11 12 |
# File 'lib/lemonway/client.rb', line 10 def instance @instance end |
Instance Method Details
#operations ⇒ Object
23 24 25 |
# File 'lib/lemonway/client.rb', line 23 def operations @instance.operations end |