Class: Redox::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



44
45
46
47
# File 'lib/redox.rb', line 44

def initialize
  @api_key  =  nil
  @secret   =  nil
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



42
43
44
# File 'lib/redox.rb', line 42

def api_key
  @api_key
end

#secretObject

Returns the value of attribute secret.



42
43
44
# File 'lib/redox.rb', line 42

def secret
  @secret
end

Instance Method Details

#api_endpointObject



53
54
55
# File 'lib/redox.rb', line 53

def api_endpoint
  return Connection.base_uri
end

#api_endpoint=(endpoint) ⇒ Object



49
50
51
# File 'lib/redox.rb', line 49

def api_endpoint=(endpoint)
  Connection.base_uri(endpoint.freeze)
end

#from_h(h) ⇒ Object



74
75
76
77
78
79
80
81
# File 'lib/redox.rb', line 74

def from_h(h)
  self.api_key = h[:api_key]
  self.secret  = h[:secret]
  self.api_endpoint = h[:api_endpoint]
  self.token_expiry_padding = h[:token_expiry_padding]

  return self
end

#to_hObject



65
66
67
68
69
70
71
72
# File 'lib/redox.rb', line 65

def to_h
  return {
    api_key: @api_key,
    secret: @secret,
    api_endpoint: api_endpoint,
    token_expiry_padding: token_expiry_padding
  }
end

#token_expiry_paddingObject



61
62
63
# File 'lib/redox.rb', line 61

def token_expiry_padding
  return Authentication.token_expiry_padding
end

#token_expiry_padding=(time_in_seconds) ⇒ Object



57
58
59
# File 'lib/redox.rb', line 57

def token_expiry_padding=(time_in_seconds)
  Authentication.token_expiry_padding = time_in_seconds
end