Class: Wispro::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/wispro/client.rb

Constant Summary collapse

PAGINATED_MODELS =
{
  bmus:      :bmu,
  clients:   :client,
  contracts: :contract,
  coverages: :coverage,
  mikrotiks: :mikrotik,
  nodes:     :node,
  plans:     :plan
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Client

Returns a new instance of Client.



16
17
18
# File 'lib/wispro/client.rb', line 16

def initialize(token)
  @options = { headers: { 'Authorization' => token } }
end

Instance Method Details

#update_client(id, data) ⇒ Object



33
34
35
36
37
38
# File 'lib/wispro/client.rb', line 33

def update_client(id, data)
  req = update_data("/clients/#{id}", body: data)
  return false unless req['status'] == 200

  req['data']
end

#update_contract(id, data) ⇒ Object



40
41
42
43
44
45
# File 'lib/wispro/client.rb', line 40

def update_contract(id, data)
  req = update_data("/contracts/#{id}", body: data)
  return false unless req['status'] == 200

  req['data']
end

#update_plan(id, data) ⇒ Object



47
48
49
50
51
52
# File 'lib/wispro/client.rb', line 47

def update_plan(id, data)
  req = update_data("/plans/#{id}", body: data)
  return false unless req['status'] == 200

  req['data']
end