Class: KaveRestApi::Config

Inherits:
RequestBase show all
Includes:
Validatable
Defined in:
lib/kavenegar-ruby/requests/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Config

Returns a new instance of Config.



8
9
10
11
12
13
14
15
16
17
# File 'lib/kavenegar-ruby/requests/config.rb', line 8

def initialize(args = {})
  @ACTION_NAME    = [:config,@FORMAT].join('.').freeze
  @apilogs          = args.fetch(:apilogs,nil)
  @dailyreport      = args.fetch(:dailyreport,nil)
  @debugmode        = args.fetch(:debugmode,nil)
  @defaultsender    = args.fetch(:defaultsender,nil)
  @mincreditalarm   = args.fetch(:mincreditalarm,nil)
  @resendfailed     = args.fetch(:resendfailed,nil)
  @response         = ResponseConfig.new
end

Instance Attribute Details

#apilogsObject

Returns the value of attribute apilogs.



5
6
7
# File 'lib/kavenegar-ruby/requests/config.rb', line 5

def apilogs
  @apilogs
end

#dailyreportObject

Returns the value of attribute dailyreport.



5
6
7
# File 'lib/kavenegar-ruby/requests/config.rb', line 5

def dailyreport
  @dailyreport
end

#debugmodeObject

Returns the value of attribute debugmode.



5
6
7
# File 'lib/kavenegar-ruby/requests/config.rb', line 5

def debugmode
  @debugmode
end

#defaultsenderObject

Returns the value of attribute defaultsender.



5
6
7
# File 'lib/kavenegar-ruby/requests/config.rb', line 5

def defaultsender
  @defaultsender
end

#mincreditalarmObject

Returns the value of attribute mincreditalarm.



5
6
7
# File 'lib/kavenegar-ruby/requests/config.rb', line 5

def mincreditalarm
  @mincreditalarm
end

#resendfailedObject

Returns the value of attribute resendfailed.



5
6
7
# File 'lib/kavenegar-ruby/requests/config.rb', line 5

def resendfailed
  @resendfailed
end

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/kavenegar-ruby/requests/config.rb', line 6

def response
  @response
end

Instance Method Details

#callObject



27
28
29
30
31
32
33
34
# File 'lib/kavenegar-ruby/requests/config.rb', line 27

def call
    connection = Faraday.new(url: "#{@API_URL}/account/") do |faraday|
      faraday.adapter Faraday.default_adapter
      faraday.response @FORMAT.to_sym
    end
     response = connection.get(@ACTION_NAME,apilogs: @apilogs,dailyreport: @dailyreport,debugmode: @debugmode,defaultsender: @defaultsender,mincreditalarm: @mincreditalarm,resendfailed: @resendfailed)
     @response.validate(response.body)
end

#full_message_errorsObject



23
24
25
# File 'lib/kavenegar-ruby/requests/config.rb', line 23

def full_message_errors
  
end

#valid?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/kavenegar-ruby/requests/config.rb', line 19

def valid?
  @valid
end