Class: PaperCup::Client
- Inherits:
-
Object
- Object
- PaperCup::Client
- Defined in:
- lib/paper_cup/client.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #endpoint(path, opts = {}) ⇒ Object
- #headers ⇒ Object
-
#initialize(opts) ⇒ Client
constructor
A new instance of Client.
- #params ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(opts) ⇒ Client
Returns a new instance of Client.
5 6 7 |
# File 'lib/paper_cup/client.rb', line 5 def initialize(opts) @options = opts end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/paper_cup/client.rb', line 3 def @options end |
Instance Method Details
#endpoint(path, opts = {}) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/paper_cup/client.rb', line 32 def endpoint(path, opts = {}) opts = merged_opts_for_request opts.merge(path: path) opts.reject! do |k,v| k == :method end return self.class.new(opts) end |
#headers ⇒ Object
13 14 15 |
# File 'lib/paper_cup/client.rb', line 13 def headers [:headers] || {} end |
#params ⇒ Object
17 18 19 |
# File 'lib/paper_cup/client.rb', line 17 def params [:params] || {} end |
#url ⇒ Object
9 10 11 |
# File 'lib/paper_cup/client.rb', line 9 def url .fetch(:url) end |