class MyJohnDeere::Configuration

Attributes

app_id[W]
contribution_definition_id[W]
endpoint[RW]
environment[R]
shared_secret[W]
use_last_active_boundary[W]

Public Class Methods

new() click to toggle source
# File lib/myjohndeere.rb, line 109
def initialize
  # Assume the sandbox endpoint
  self.environment = :sandbox
  @shared_secret = nil
  @app_id = nil
end

Public Instance Methods

app_id() click to toggle source
# File lib/myjohndeere.rb, line 132
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_id() click to toggle source
# File lib/myjohndeere.rb, line 116
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
environment=(val) click to toggle source
# File lib/myjohndeere.rb, line 101
def environment=(val)
  @environment = val.to_sym
  @endpoint = ENDPOINTS[@environment]
  if @endpoint.nil?
    raise ConfigurationError.new('Invalid environment, you must use either :sandbox or :production. Sandbox is the default')
  end
end
log_level() click to toggle source
# File lib/myjohndeere.rb, line 96
def log_level
  @log_level ||= :fatal
  return @log_level
end
log_level=(val) click to toggle source
# File lib/myjohndeere.rb, line 87
def log_level=(val)
  @log_level = val
end
shared_secret() click to toggle source
# File lib/myjohndeere.rb, line 124
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
use_last_active_boundary() click to toggle source
# File lib/myjohndeere.rb, line 91
def use_last_active_boundary
  @use_last_active_boundary ||= false
  return @use_last_active_boundary
end