Class: IdentityMind::Entity

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/identity_mind/entity.rb

Direct Known Subclasses

Account::Consumer, Account::Merchant

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_payload) ⇒ Entity

Returns a new instance of Entity.



3
4
5
# File 'lib/identity_mind/entity.rb', line 3

def initialize(json_payload)
  super(JSON.parse(json_payload, symbolize_names: true))
end

Class Method Details

.create(params) ⇒ Object



12
13
14
# File 'lib/identity_mind/entity.rb', line 12

def create(params)
  new(IdentityMind.post(path, body: Params[params].to_json).body)
end

.fetch(transaction_id) ⇒ Object



16
17
18
# File 'lib/identity_mind/entity.rb', line 16

def fetch(transaction_id)
  new(IdentityMind.get("#{path}/#{transaction_id}").body)
end

.pathObject



8
9
10
# File 'lib/identity_mind/entity.rb', line 8

def path
  "/im/#{to_s.split('::')[1..-1].map!(&:downcase).join('/')}"
end