Class: Bitly::ShortenResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/providers/bitly/response.rb

Instance Attribute Summary collapse

Attributes inherited from Response

#format

Instance Method Summary collapse

Methods inherited from Response

#initialize, #parser

Constructor Details

This class inherits a constructor from Bitly::Response

Instance Attribute Details

#global_hashObject (readonly)

Returns the value of attribute global_hash.



30
31
32
# File 'lib/providers/bitly/response.rb', line 30

def global_hash
  @global_hash
end

#hashObject (readonly)

Returns the value of attribute hash.



30
31
32
# File 'lib/providers/bitly/response.rb', line 30

def hash
  @hash
end

#long_urlObject (readonly)

Returns the value of attribute long_url.



30
31
32
# File 'lib/providers/bitly/response.rb', line 30

def long_url
  @long_url
end

#urlObject (readonly)

Returns the value of attribute url.



30
31
32
# File 'lib/providers/bitly/response.rb', line 30

def url
  @url
end

Instance Method Details

#parseObject

Assuming format is always json for now.



33
34
35
36
37
# File 'lib/providers/bitly/response.rb', line 33

def parse
  @parsed_response = @parser.parse(@response)
  @url = @parsed_response["data"]["url"]
  @hash = @parsed_response["data"]["hash"]
end