Module: MixinBot::API::Snapshot

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

Instance Method Summary collapse

Instance Method Details

#network_snapshot(snapshot_id, **options) ⇒ Object Also known as: read_network_snapshot



36
37
38
39
40
41
42
# File 'lib/mixin_bot/api/snapshot.rb', line 36

def network_snapshot(snapshot_id, **options)
  path = format('/network/snapshots/%<snapshot_id>s', snapshot_id: snapshot_id)

  access_token = options[:access_token] || access_token('GET', path)
  authorization = format('Bearer %<access_token>s', access_token: access_token)
  client.get(path, headers: { 'Authorization': authorization })
end

#network_snapshots(**options) ⇒ Object Also known as: read_network_snapshots



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/mixin_bot/api/snapshot.rb', line 6

def network_snapshots(**options)
  path = format(
    '/network/snapshots?limit=%<limit>s&offset=%<offset>s&asset=%<asset>s&order=%<order>s',
    limit: options[:limit],
    offset: options[:offset],
    asset: options[:asset],
    order: options[:order]
  )

  access_token = options[:access_token] || access_token('GET', path)
  authorization = format('Bearer %<access_token>s', access_token: access_token)
  client.get(path, headers: { 'Authorization': authorization })
end

#snapshots(**options) ⇒ Object Also known as: read_snapshots



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/mixin_bot/api/snapshot.rb', line 21

def snapshots(**options)
  path = format(
    '/snapshots?limit=%<limit>s&offset=%<offset>s&asset=%<asset>s&opponent=%<opponent>s',
    limit: options[:limit],
    offset: options[:offset],
    asset: options[:asset],
    opponent: options[:opponent]
  )

  access_token = options[:access_token] || access_token('GET', path)
  authorization = format('Bearer %<access_token>s', access_token: access_token)
  client.get(path, headers: { 'Authorization': authorization })
end