Exception: InstagramApi::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Error

Returns a new instance of Error.



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

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.



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

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



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

def message
  @message
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end