class LucidShopify::Client

Public Class Methods

new(send_request: Container[:send_request], send_throttled_request: Container[:send_throttled_request], throttling: false) click to toggle source

@param send_request [#call] @param send_throttled_request [#call]

# 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

Public Instance Methods

delete(*args) click to toggle source

@see DeleteRequest#initialize

# File lib/lucid_shopify/client.rb, line 65
def delete(*args)
  send_request.(DeleteRequest.new(*args))
end
get(*args) click to toggle source

@see GetRequest#initialize

# File lib/lucid_shopify/client.rb, line 72
def get(*args)
  send_request.(GetRequest.new(*args))
end
post_json(*args) click to toggle source

@see PostRequest#initialize

# File lib/lucid_shopify/client.rb, line 79
def post_json(*args)
  send_request.(PostRequest.new(*args))
end
put_json(*args) click to toggle source

@see PutRequest#initialize

# File lib/lucid_shopify/client.rb, line 86
def put_json(*args)
  send_request.(PutRequest.new(*args))
end
throttled() click to toggle source

Returns a new instance with throttling enabled, or self.

@return [Client, self]

# File lib/lucid_shopify/client.rb, line 45
def throttled
  return self if throttled?

  self.class.new(**@params, throttling: true)
end
throttled?() click to toggle source

@return [Boolean]

# File lib/lucid_shopify/client.rb, line 36
def throttled?
  @throttling
end
unthrottled() click to toggle source

Returns a new instance with throttling disabled, or self.

@return [Client, self]

# File lib/lucid_shopify/client.rb, line 56
def unthrottled
  return self unless throttled?

  self.class.new(**@params, throttling: false)
end

Private Instance Methods

send_request() click to toggle source

@return [#call]

# File lib/lucid_shopify/client.rb, line 29
        def send_request
  throttled? ? @send_throttled_request : @send_request
end