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.
17 18 19 20 21 |
# File 'lib/mobile/client.rb', line 17 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.
15 16 17 |
# File 'lib/mobile/client.rb', line 15 def api_version @api_version end |
#password ⇒ Object
Returns the value of attribute password.
15 16 17 |
# File 'lib/mobile/client.rb', line 15 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
15 16 17 |
# File 'lib/mobile/client.rb', line 15 def username @username end |
Instance Method Details
#ad(id, options = {}) ⇒ Object
28 29 30 |
# File 'lib/mobile/client.rb', line 28 def ad(id, ={}) request('get', "/ad/#{id}", )['ad'] end |
#ads(options = {}) ⇒ Object
24 25 26 |
# File 'lib/mobile/client.rb', line 24 def ads(={}) request('get', '/ad/search', )['result'] end |
#configured? ⇒ Boolean
32 33 34 35 |
# File 'lib/mobile/client.rb', line 32 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 |