Class: CoinsPaid::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/coins_paid/address.rb

Defined Under Namespace

Modules: Types Classes: Data

Instance Method Summary collapse

Instance Method Details

#callObject



19
20
21
22
23
24
25
26
27
# File 'lib/coins_paid/address.rb', line 19

def call
  ActiveRecord::Base.transaction do
    lookup_attrs = request_data.attributes.slice(:foreign_id, :convert_to, :currency)
    CoinsPaidAddress.lock.find_or_create_by!(lookup_attrs) do |address|
      response = CoinsPaid::API.take_address(request_data.attributes)
      address.assign_attributes(response.attributes)
    end
  end
end