Class: Upkey::Chatterly::Client
- Inherits:
-
Object
- Object
- Upkey::Chatterly::Client
- Defined in:
- lib/upkey/chatterly/client.rb
Instance Attribute Summary collapse
-
#access_key ⇒ Object
readonly
Returns the value of attribute access_key.
-
#chatterly_url ⇒ Object
readonly
Returns the value of attribute chatterly_url.
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Client
constructor
A new instance of Client.
- #method_missing(*args) ⇒ Object
- #respond(args = {}) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Client
Returns a new instance of Client.
20 21 22 23 24 25 26 |
# File 'lib/upkey/chatterly/client.rb', line 20 def initialize(args = {}) MissingArgument.alert unless args[:access_key] && args[:chatterly_url] @access_key = args[:access_key] @chatterly_url = args[:chatterly_url] @conn = set_up_faraday end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/upkey/chatterly/client.rb', line 38 def method_missing(*args) case args[0] when :post_url Upkey::Chatterly::Urls::Builder.post_url(args[1], self) when :get_url Upkey::Chatterly::Urls::Accessor.get_url(args[1], self) else raise NoMethodError end end |
Instance Attribute Details
#access_key ⇒ Object (readonly)
Returns the value of attribute access_key.
18 19 20 |
# File 'lib/upkey/chatterly/client.rb', line 18 def access_key @access_key end |
#chatterly_url ⇒ Object (readonly)
Returns the value of attribute chatterly_url.
18 19 20 |
# File 'lib/upkey/chatterly/client.rb', line 18 def chatterly_url @chatterly_url end |
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
18 19 20 |
# File 'lib/upkey/chatterly/client.rb', line 18 def conn @conn end |
Instance Method Details
#respond(args = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/upkey/chatterly/client.rb', line 28 def respond(args = {}) key = args[:key] id = args[:id] = Upkey::Chatterly::Accessor.(self, key, id) resp = Upkey::Chatterly::Accessor.get_resp(self, .body) Upkey::Chatterly::Response.new(, resp) end |