Exception: InstagramApi::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/instagram_api/exceptions.rb

Overview

Custom error class to rescue from Instagram errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Error

Returns a new instance of Error.



7
8
9
10
11
12
13
# File 'lib/instagram_api/exceptions.rb', line 7

def initialize(response)
  body = JSON.parse(response.body)

  @code = "#{response[:status]}"
  @type = body['meta']['error_type']
  @message = body['meta']['error_message']
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



5
6
7
# File 'lib/instagram_api/exceptions.rb', line 5

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



5
6
7
# File 'lib/instagram_api/exceptions.rb', line 5

def message
  @message
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/instagram_api/exceptions.rb', line 5

def type
  @type
end