Class: MyJohnDeere::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



103
104
105
106
107
108
# File 'lib/myjohndeere.rb', line 103

def initialize
  # Assume the sandbox endpoint
  self.environment = :sandbox
  @shared_secret = nil
  @app_id = nil
end

Instance Attribute Details

#app_idObject



126
127
128
129
130
131
132
# File 'lib/myjohndeere.rb', line 126

def app_id
  if @app_id.nil? then
    raise ConfigurationError.new('No app_id provided in configuration. ' \
      'Please set this according to your Deere Developer app credentials.')
  end
  return @app_id
end

#contribution_definition_idObject



110
111
112
113
114
115
116
# File 'lib/myjohndeere.rb', line 110

def contribution_definition_id
  if @contribution_definition_id.nil? then
    raise ConfigurationError.new('No contribution_definition_id provided in configuration. ' \
      'Please set this to make the request, you\'ll need to contact JohnDeere support to get this value.')
  end
  return @contribution_definition_id
end

#endpointObject

Returns the value of attribute endpoint.



82
83
84
# File 'lib/myjohndeere.rb', line 82

def endpoint
  @endpoint
end

#environmentObject

Returns the value of attribute environment.



84
85
86
# File 'lib/myjohndeere.rb', line 84

def environment
  @environment
end

#shared_secretObject



118
119
120
121
122
123
124
# File 'lib/myjohndeere.rb', line 118

def shared_secret
  if @shared_secret.nil? then
    raise ConfigurationError.new('No shared_secret provided in configuration. ' \
      'Please set this according to your Deere Developer app credentials.')
  end
  return @shared_secret
end

Instance Method Details

#log_levelObject



90
91
92
93
# File 'lib/myjohndeere.rb', line 90

def log_level
  @log_level ||= :fatal
  return @log_level
end

#log_level=(val) ⇒ Object



86
87
88
# File 'lib/myjohndeere.rb', line 86

def log_level=(val)
  @log_level = val
end