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.



101
102
103
104
105
106
# File 'lib/myjohndeere.rb', line 101

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

Instance Attribute Details

#app_idObject



124
125
126
127
128
129
130
# File 'lib/myjohndeere.rb', line 124

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



108
109
110
111
112
113
114
# File 'lib/myjohndeere.rb', line 108

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.



80
81
82
# File 'lib/myjohndeere.rb', line 80

def endpoint
  @endpoint
end

#environmentObject

Returns the value of attribute environment.



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

def environment
  @environment
end

#shared_secretObject



116
117
118
119
120
121
122
# File 'lib/myjohndeere.rb', line 116

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



88
89
90
91
# File 'lib/myjohndeere.rb', line 88

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

#log_level=(val) ⇒ Object



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

def log_level=(val)
  @log_level = val
end