Class: PayjpMock::Response::Resource::Base

Inherits:
Base
  • Object
show all
Includes:
Util
Defined in:
lib/payjp_mock/response/resource/base.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes

Instance Method Summary collapse

Methods included from Util

#generate_fingerprint, #generate_resource_id

Methods inherited from Base

#body, #exception, #to_h

Constructor Details

#initialize(attributes = {}) ⇒ Base

Returns a new instance of Base.



6
7
8
9
# File 'lib/payjp_mock/response/resource/base.rb', line 6

def initialize(attributes = {})
  @attributes = default_attributes
  set(attributes.symbolize_keys)
end

Instance Method Details

#canonicalize(key, value) ⇒ Object



18
19
20
# File 'lib/payjp_mock/response/resource/base.rb', line 18

def canonicalize(key, value)
  { key => value }
end

#set(attributes) ⇒ Object



11
12
13
14
15
16
# File 'lib/payjp_mock/response/resource/base.rb', line 11

def set(attributes)
  attributes.each do |k, v|
    @attributes.merge!(canonicalize(k, v))
  end
  self
end

#statusObject



22
23
24
# File 'lib/payjp_mock/response/resource/base.rb', line 22

def status
  200
end