Class: Mobile::Client
Instance Attribute Summary collapse
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #ad(id, options = {}) ⇒ Object
- #ads(options = {}) ⇒ Object
- #configured? ⇒ Boolean
-
#initialize {|_self| ... } ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize {|_self| ... } ⇒ Client
Returns a new instance of Client.
16 17 18 19 20 |
# File 'lib/mobile/client.rb', line 16 def initialize(&block) yield(self) self.api_version = '1.0.0' if self.api_version.nil? self end |
Instance Attribute Details
#api_version ⇒ Object
Returns the value of attribute api_version.
14 15 16 |
# File 'lib/mobile/client.rb', line 14 def api_version @api_version end |
#password ⇒ Object
Returns the value of attribute password.
14 15 16 |
# File 'lib/mobile/client.rb', line 14 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
14 15 16 |
# File 'lib/mobile/client.rb', line 14 def username @username end |
Instance Method Details
#ad(id, options = {}) ⇒ Object
27 28 29 |
# File 'lib/mobile/client.rb', line 27 def ad(id, ={}) request('get', "/ad/#{id}", )['ad'] end |
#ads(options = {}) ⇒ Object
23 24 25 |
# File 'lib/mobile/client.rb', line 23 def ads(={}) request('get', '/ad/search', )['result'] end |
#configured? ⇒ Boolean
31 32 33 34 |
# File 'lib/mobile/client.rb', line 31 def configured? raise Mobile::MissingConfig, "Either username or password is not set in configuration block. Please fix this." unless !username.nil? && !password.nil? !username.nil? && !password.nil? end |