Class: HighLevel::Resources::Marketplace

Inherits:
Base
  • Object
show all
Defined in:
lib/high_level/resources/marketplace.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from HighLevel::Resources::Base

Instance Method Details

#charge(body:, **_opts) ⇒ Object

Create a new wallet charge



20
21
22
23
24
25
26
27
# File 'lib/high_level/resources/marketplace.rb', line 20

def charge(body:, **_opts)
  request(
    method: :post,
    path: "/marketplace/billing/charges",
    security: ["Location-Access-Only"],
    body: body
  )
end

#delete_charge(charge_id:, **_opts) ⇒ Object

Delete a wallet charge



39
40
41
42
43
44
45
# File 'lib/high_level/resources/marketplace.rb', line 39

def delete_charge(charge_id:, **_opts)
  request(
    method: :delete,
    path: "/marketplace/billing/charges/#{charge_id}",
    security: ["Location-Access-Only"]
  )
end

#get_charges(meter_id: nil, event_id: nil, user_id: nil, start_date: nil, end_date: nil, skip: nil, limit: nil, **_opts) ⇒ Object

Get all wallet charges



10
11
12
13
14
15
16
17
# File 'lib/high_level/resources/marketplace.rb', line 10

def get_charges(meter_id: nil, event_id: nil, user_id: nil, start_date: nil, end_date: nil, skip: nil, limit: nil, **_opts)
  request(
    method: :get,
    path: "/marketplace/billing/charges",
    security: ["Location-Access-Only"],
    params: { "meterId" => meter_id, "eventId" => event_id, "userId" => user_id, "startDate" => start_date, "endDate" => end_date, "skip" => skip, "limit" => limit }.compact
  )
end

#get_installer_details(app_id:, **_opts) ⇒ Object

Get Installer Details

Fetches installer details for the authenticated user. This endpoint returns information about the company, location, user, and installation details associated with the current OAuth token.



59
60
61
62
63
64
65
# File 'lib/high_level/resources/marketplace.rb', line 59

def get_installer_details(app_id:, **_opts)
  request(
    method: :get,
    path: "/marketplace/app/#{app_id}/installations",
    security: %w[Location-Access-Only Agency-Access-Only]
  )
end

#get_rebilling_config_for_app(app_id:, location_id:, **_opts) ⇒ Object

Get rebilling config for an app subscription and usage plans

Get rebilling config for an app subscription and usage plans for the authenticated sub-account. This endpoint returns the subscription and usage plans for an app.



82
83
84
85
86
87
88
# File 'lib/high_level/resources/marketplace.rb', line 82

def get_rebilling_config_for_app(app_id:, location_id:, **_opts)
  request(
    method: :get,
    path: "/marketplace/app/#{app_id}/rebilling-config/location/#{location_id}",
    security: ["Location-Access-Only"]
  )
end

#get_specific_charge(charge_id:, **_opts) ⇒ Object

Get specific wallet charge details



30
31
32
33
34
35
36
# File 'lib/high_level/resources/marketplace.rb', line 30

def get_specific_charge(charge_id:, **_opts)
  request(
    method: :get,
    path: "/marketplace/billing/charges/#{charge_id}",
    security: ["Location-Access-Only"]
  )
end

#has_funds(**_opts) ⇒ Object

Check if account has sufficient funds



48
49
50
51
52
53
54
# File 'lib/high_level/resources/marketplace.rb', line 48

def has_funds(**_opts)
  request(
    method: :get,
    path: "/marketplace/billing/charges/has-funds",
    security: ["Location-Access-Only"]
  )
end

#migrate_connection(body:, **_opts) ⇒ Object

Migrate external authentication connection

Migrates an external authentication connection credentials (basic or oauth2) for a specific app and location. This endpoint validates the app configuration, stores credentials safely in CRM’s native encrypted storage. With this the lifecycle of the token is managed by CRM.



93
94
95
96
97
98
99
100
# File 'lib/high_level/resources/marketplace.rb', line 93

def migrate_connection(body:, **_opts)
  request(
    method: :post,
    path: "/marketplace/external-auth/migration",
    security: %w[Location-Access Location-Access-Only],
    body: body
  )
end

#uninstall_application(app_id:, body:, **_opts) ⇒ Object

Uninstall an application

Uninstalls an application from your company or a specific location. This will remove the application`s access and stop all its functionalities



70
71
72
73
74
75
76
77
# File 'lib/high_level/resources/marketplace.rb', line 70

def uninstall_application(app_id:, body:, **_opts)
  request(
    method: :delete,
    path: "/marketplace/app/#{app_id}/installations",
    security: %w[Location-Access-Only Agency-Access],
    body: body
  )
end