Class: FbErrorMachine::MarketingApiError

Inherits:
ErrorBase
  • Object
show all
Defined in:
lib/fb_error_machine/marketing_api_error.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from ErrorBase

#initialize

Constructor Details

This class inherits a constructor from FbErrorMachine::ErrorBase

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/fb_error_machine/marketing_api_error.rb', line 5

def description
  @description
end

#error_codeObject

Returns the value of attribute error_code.



5
6
7
# File 'lib/fb_error_machine/marketing_api_error.rb', line 5

def error_code
  @error_code
end

#instructionsObject

Returns the value of attribute instructions.



5
6
7
# File 'lib/fb_error_machine/marketing_api_error.rb', line 5

def instructions
  @instructions
end

Class Method Details

.allObject



7
8
9
10
11
12
13
14
15
# File 'lib/fb_error_machine/marketing_api_error.rb', line 7

def self.all
  @_errors ||= begin
    YAML.load_file(File.join(File.dirname(__FILE__), "marketing_api_errors.yml")).map do |entry|
      GraphApiError.new(entry)
    end
  rescue Psych::SyntaxError, Errno::EACCES, Errno::ENOENT
    {}
  end
end

.find(error_code) ⇒ Object



17
18
19
# File 'lib/fb_error_machine/marketing_api_error.rb', line 17

def self.find(error_code)
  MarketingApiError.all.detect { |e| e.error_code == error_code.to_s }
end