Sha256: 95eb741fde8c5189aea1abda4a4740c0dd56ce7977d586c1a14c4db93e1b594b

Contents?: true

Size: 566 Bytes

Versions: 2

Compression:

Stored size: 566 Bytes

Contents

module Arlo
  class API

    def initialize
      @@token = nil
    end

    def get_token
      return @@token if @@token
      email = ENV['ARLO_EMAIL']
      raise 'Missing ARLO_EMAIL environment variable' unless email
      password = ENV['ARLO_PASSWORD']
      raise 'Missing ARLO_PASSWORD environment variable' unless password

      payload = {
        "email": email,
        "password": password
      }
      response = post('https://arlo.netgear.com/hmsweb/login/v2', payload)
      @@token = JSON.parse(response.body)['data']['token']
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arlo-0.0.3 lib/arlo/token.rb
arlo-0.0.2 lib/arlo/token.rb