Class: Withings::Api::ConsumerToken

Inherits:
Object
  • Object
show all
Defined in:
lib/withings-api/tokens.rb

Overview

Encapsulates a consumer app key/secret pair

Direct Known Subclasses

AccessToken, RequestToken

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*arguments) ⇒ ConsumerToken

Multiple variations

  • #initialize()

  • #initialize(key, secret)



11
12
13
14
15
16
17
18
19
# File 'lib/withings-api/tokens.rb', line 11

def initialize(*arguments)
  if arguments.length == 0
  elsif arguments.length == 2
    self.key = arguments.shift
    self.secret = arguments.shift
  else
    raise ArgumentError
  end
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



5
6
7
# File 'lib/withings-api/tokens.rb', line 5

def key
  @key
end

#secretObject

Returns the value of attribute secret.



5
6
7
# File 'lib/withings-api/tokens.rb', line 5

def secret
  @secret
end

Instance Method Details

#to_aObject



21
22
23
# File 'lib/withings-api/tokens.rb', line 21

def to_a
  [key, secret]
end