Class: Atol::Request::PostDocument::Sell::Body

Inherits:
Object
  • Object
show all
Defined in:
lib/atol/request/post_document/sell/body.rb

Instance Method Summary collapse

Constructor Details

#initialize(external_id:, phone: '', email: '', items:, config: nil) ⇒ Body

Returns a new instance of Body.



10
11
12
13
14
15
16
17
18
19
# File 'lib/atol/request/post_document/sell/body.rb', line 10

def initialize(external_id:, phone: '', email: '', items:, config: nil)
  raise(Atol::EmptyClientContactError) if phone.empty? && email.empty?
  raise(Atol::EmptySellItemsError) if items.empty?

  @config = config || Atol.config
  @external_id = external_id
  @phone = phone
  @email = email
  @items = items
end

Instance Method Details

#to_hObject



21
22
23
# File 'lib/atol/request/post_document/sell/body.rb', line 21

def to_h
  body.clone
end

#to_jsonObject



25
26
27
# File 'lib/atol/request/post_document/sell/body.rb', line 25

def to_json
  body.to_json
end