Class: LeanCloud::Client
- Inherits:
-
Object
- Object
- LeanCloud::Client
- Defined in:
- lib/lean_cloud/client.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #adapter ⇒ Object
- #headers(options = {}) ⇒ Object
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
- #instance(options = {}, &block) ⇒ Object
- #url ⇒ Object
Constructor Details
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/lean_cloud/client.rb', line 7 def @options end |
Instance Method Details
#adapter ⇒ Object
16 17 18 |
# File 'lib/lean_cloud/client.rb', line 16 def adapter http_adapter end |
#headers(options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/lean_cloud/client.rb', line 24 def headers(={}) { "X-AVOSCloud-Application-Id" => app_id, "X-AVOSCloud-Application-Key" => app_key, "X-AVOSCloud-Master-Key" => master_key, 'Content-Type' => 'application/json', 'User-Agent' => "LeanCloud SDK Ruby / #{LeanCloud::VERSION}" }.merge() end |
#instance(options = {}, &block) ⇒ Object
20 21 22 |
# File 'lib/lean_cloud/client.rb', line 20 def instance(={}, &block) adapter.new(url, headers: headers, &block) end |
#url ⇒ Object
34 35 36 |
# File 'lib/lean_cloud/client.rb', line 34 def url [host, version].join('/') end |