Class: PayjpMock::Response::List

Inherits:
Base
  • Object
show all
Defined in:
lib/payjp_mock/response/list.rb

Constant Summary collapse

OBJECT =
'list'.freeze

Instance Attribute Summary

Attributes inherited from Base

#attributes

Instance Method Summary collapse

Methods inherited from Base

#body, #exception, #to_h

Constructor Details

#initialize(path, count: 3) ⇒ List

Returns a new instance of List.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/payjp_mock/response/list.rb', line 5

def initialize(path, count: 3)
  @attributes = {
    count:    0,
    data:     [],
    has_more: false,
    object:   OBJECT,
    url:      "/#{PayjpMock::Request::API_VERSION}" + path
  }
  return unless block_given?

  @attributes[:count] = count
  @attributes[:data]  = count.times.map { yield.to_h }
end

Instance Method Details

#statusObject



19
20
21
# File 'lib/payjp_mock/response/list.rb', line 19

def status
  200
end