class Lipseys::Shipping

Constants

ENDPOINTS

Public Class Methods

new(client) click to toggle source
# File lib/lipseys/shipping.rb, line 12
def initialize(client)
  @client = client
end

Public Instance Methods

fetch(since_date = nil) click to toggle source
# File lib/lipseys/shipping.rb, line 16
def fetch(since_date = nil)
  endpoint = ENDPOINTS[:fetch]
  since_date = (since_date || Time.now.prev_day).strftime('%m/%d/%Y')
  headers  = [
    *auth_header(@client.access_token),
    *content_type_header('application/json'),
  ].to_h

  post_request(endpoint, "\"#{since_date}\"", headers)
end