Class: OpenSRS::OMA
- Inherits:
-
JsonRPC::Client
- Object
- JsonRPC::Client
- OpenSRS::OMA
- Includes:
- ErrorHandler
- Defined in:
- lib/opensrs/oma.rb
Constant Summary collapse
- VERSION =
'0.0.2'- METHODS =
removed, in favour of metaprogramming
%w( )
Instance Attribute Summary collapse
-
#methods ⇒ Object
readonly
Returns the value of attribute methods.
-
#password ⇒ Object
Returns the value of attribute password.
-
#url ⇒ Object
Returns the value of attribute url.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
-
.create_methods ⇒ Object
This method is deprecated..
Instance Method Summary collapse
-
#initialize(opt = {}) ⇒ OMA
constructor
A new instance of OMA.
- #method_missing(m, *args, &block) ⇒ Object
- #uri(method = @method) ⇒ Object
Methods included from ErrorHandler
Methods inherited from JsonRPC::Client
Constructor Details
#initialize(opt = {}) ⇒ OMA
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/opensrs/oma.rb', line 60 def initialize( opt={} ) #OMA.create_methods @username = opt[:username] || '' @password = opt[:password] || '' @url = opt[:url] || 'https://admin.a.hostedemail.com/api' @credentials = { :client => "Ruby OpenSRS::OMA 0.0.2", :user => @username, :password => @password } super( @url, @credentials ) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
88 89 90 91 |
# File 'lib/opensrs/oma.rb', line 88 def method_missing( m, *args, &block ) @method = m request( m, *args ) end |
Instance Attribute Details
#methods ⇒ Object (readonly)
Returns the value of attribute methods.
58 59 60 |
# File 'lib/opensrs/oma.rb', line 58 def methods @methods end |
#password ⇒ Object
Returns the value of attribute password.
57 58 59 |
# File 'lib/opensrs/oma.rb', line 57 def password @password end |
#url ⇒ Object
Returns the value of attribute url.
55 56 57 |
# File 'lib/opensrs/oma.rb', line 55 def url @url end |
#username ⇒ Object
Returns the value of attribute username.
56 57 58 |
# File 'lib/opensrs/oma.rb', line 56 def username @username end |
Class Method Details
.create_methods ⇒ Object
This method is deprecated..
79 80 81 82 83 84 85 86 |
# File 'lib/opensrs/oma.rb', line 79 def self.create_methods METHODS.each do |method| define_method method do |*argv| @method = method valid?( request method, *argv ) end end end |
Instance Method Details
#uri(method = @method) ⇒ Object
71 72 73 |
# File 'lib/opensrs/oma.rb', line 71 def uri ( method = @method ) URI.parse( @base + "/" + method.to_s) end |