Module: MixinBot::API::Asset

Included in:
MixinBot::API
Defined in:
lib/mixin_bot/api/asset.rb

Instance Method Summary collapse

Instance Method Details

#asset(asset_id, access_token: nil) ⇒ Object



13
14
15
16
# File 'lib/mixin_bot/api/asset.rb', line 13

def asset(asset_id, access_token: nil)
  path = format('/assets/%<asset_id>s', asset_id:)
  client.get path, access_token:
end

#assets(access_token: nil) ⇒ Object



7
8
9
10
# File 'lib/mixin_bot/api/asset.rb', line 7

def assets(access_token: nil)
  path = '/assets'
  client.get path, access_token:
end

#ticker(asset_id, **kwargs) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/mixin_bot/api/asset.rb', line 19

def ticker(asset_id, **kwargs)
  offset = kwargs[:offset]
  offset = DateTime.rfc3339(offset) if offset.is_a? String
  offset = offset.rfc3339 if offset.is_a?(DateTime) || offset.is_a?(Time)

  path = '/ticker'
  client.get path, asset_id:, offset:, access_token: kwargs[:access_token]
end