Class: Explore::Cli::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/explore/cli.rb

Constant Summary collapse

OWNER_ONLY_PATH_PREFIXES =
[
  "/api/agent/v1/drafts",
  "/api/agent/v1/onboarding/status",
  "/api/agent/v1/manifest/next_actions",
  "/api/agent/v1/notion/sync_status",
  "/api/agent/v1/publish/preview",
  "/api/agent/v1/content/create_draft",
  "/api/agent/v1/content/propose_update"
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(base_url:, api_key: nil) ⇒ Client

Returns a new instance of Client.



31
32
33
34
# File 'lib/explore/cli.rb', line 31

def initialize(base_url:, api_key: nil)
  @base_url = base_url
  @api_key = api_key
end

Instance Method Details

#get(path, params: {}) ⇒ Object



36
37
38
# File 'lib/explore/cli.rb', line 36

def get(path, params: {})
  request(Net::HTTP::Get, path, params:)
end

#patch(path, params: {}, json: nil) ⇒ Object



48
49
50
# File 'lib/explore/cli.rb', line 48

def patch(path, params: {}, json: nil)
  request(Net::HTTP::Patch, path, params:, json:)
end

#post(path, params: {}, json: nil) ⇒ Object



40
41
42
# File 'lib/explore/cli.rb', line 40

def post(path, params: {}, json: nil)
  request(Net::HTTP::Post, path, params:, json:)
end

#put(path, params: {}, json: nil) ⇒ Object



44
45
46
# File 'lib/explore/cli.rb', line 44

def put(path, params: {}, json: nil)
  request(Net::HTTP::Put, path, params:, json:)
end