Class: TwicasStream::Supporter::SupportingList
- Inherits:
-
Object
- Object
- TwicasStream::Supporter::SupportingList
- Defined in:
- lib/twicas_stream/supporter.rb
Constant Summary collapse
- PREFIX_URL =
'users'
- SUFFIX_URL =
'supporting'
- DEFAULT_OFFSET =
0
- LOWER_OFFSET =
0
- DEFAULT_LIMIT =
20
- LOWER_LIMIT =
1
- UPPER_LIMIT =
20
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(user_id, offset = DEFAULT_OFFSET, limit = DEFAULT_LIMIT) ⇒ SupportingList
constructor
A new instance of SupportingList.
Constructor Details
#initialize(user_id, offset = DEFAULT_OFFSET, limit = DEFAULT_LIMIT) ⇒ SupportingList
Returns a new instance of SupportingList.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/twicas_stream/supporter.rb', line 52 def initialize user_id, offset = DEFAULT_OFFSET, limit = DEFAULT_LIMIT @response = Hash.new param = Hash.new if offset < LOWER_OFFSET STDERR.puts "#{__FILE__}:#{__LINE__}:Warning: out of limitation. offset should be over #{LOWER_OFFSET}." end unless limit >= LOWER_LIMIT and limit <= UPPER_LIMIT STDERR.puts "#{__FILE__}:#{__LINE__}:Warning: out of limitation. limit range is #{LOWER_LIMIT} ~ #{UPPER_LIMIT}." end param['offset'] = offset param['limit'] = limit url = [BASE_URL, PREFIX_URL, user_id, SUFFIX_URL].join('/') + TwicasStream.make_query_string(param) # => 'https://apiv2.twitcasting.tv/users/twitcasting_jp/supporting?offset=10&limit=20' @response = TwicasStream.parse(TwicasStream.get(url)) end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
36 37 38 |
# File 'lib/twicas_stream/supporter.rb', line 36 def response @response end |