Class: LucidShopify::Client
- Inherits:
-
Object
- Object
- LucidShopify::Client
- Defined in:
- lib/lucid_shopify/client.rb
Instance Method Summary collapse
- #delete(*args) ⇒ Object
- #get(*args) ⇒ Object
-
#initialize(send_request: Container[:send_request], send_throttled_request: Container[:send_throttled_request], throttling: false) ⇒ Client
constructor
A new instance of Client.
- #post_json(*args) ⇒ Object
- #put_json(*args) ⇒ Object
-
#throttled ⇒ Client, self
Returns a new instance with throttling enabled, or self.
- #throttled? ⇒ Boolean
-
#unthrottled ⇒ Client, self
Returns a new instance with throttling disabled, or self.
Constructor Details
#initialize(send_request: Container[:send_request], send_throttled_request: Container[:send_throttled_request], throttling: false) ⇒ Client
Returns a new instance of Client.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lucid_shopify/client.rb', line 13 def initialize(send_request: Container[:send_request], send_throttled_request: Container[:send_throttled_request], throttling: false) @send_request = send_request @send_throttled_request = send_throttled_request @throttling = throttling @params = { send_request: @send_request, send_throttled_request: @send_throttled_request } end |
Instance Method Details
#delete(*args) ⇒ Object
65 66 67 |
# File 'lib/lucid_shopify/client.rb', line 65 def delete(*args) send_request.(DeleteRequest.new(*args)) end |
#get(*args) ⇒ Object
72 73 74 |
# File 'lib/lucid_shopify/client.rb', line 72 def get(*args) send_request.(GetRequest.new(*args)) end |
#post_json(*args) ⇒ Object
79 80 81 |
# File 'lib/lucid_shopify/client.rb', line 79 def post_json(*args) send_request.(PostRequest.new(*args)) end |
#put_json(*args) ⇒ Object
86 87 88 |
# File 'lib/lucid_shopify/client.rb', line 86 def put_json(*args) send_request.(PutRequest.new(*args)) end |
#throttled ⇒ Client, self
Returns a new instance with throttling enabled, or self.
45 46 47 48 49 |
# File 'lib/lucid_shopify/client.rb', line 45 def throttled return self if throttled? self.class.new(**@params, throttling: true) end |
#throttled? ⇒ Boolean
36 37 38 |
# File 'lib/lucid_shopify/client.rb', line 36 def throttled? @throttling end |
#unthrottled ⇒ Client, self
Returns a new instance with throttling disabled, or self.
56 57 58 59 60 |
# File 'lib/lucid_shopify/client.rb', line 56 def unthrottled return self unless throttled? self.class.new(**@params, throttling: false) end |