Class: Cruz::Client::Keys

Inherits:
Object
  • Object
show all
Defined in:
lib/cruz/client/keys.rb

Overview

Keys client

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Keys

Returns a new instance of Keys.



5
6
7
# File 'lib/cruz/client/keys.rb', line 5

def initialize(client)
  @client = client
end

Instance Method Details

#deactive(key_id, params = {}, headers = {}) ⇒ Object



24
25
26
# File 'lib/cruz/client/keys.rb', line 24

def deactive(key_id, params = {}, headers = {})
  @client.rest_post_with_token("/keys/#{key_id}/deactive", params, headers)
end

#get_keys(sku_id, quantity = 1, params = {}, headers = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/cruz/client/keys.rb', line 16

def get_keys(sku_id, quantity = 1, params = {}, headers = {})
  payload = params.merge(
    skuId: sku_id,
    quantity: quantity
  )
  @client.rest_post_with_token('/keys', payload, headers)
end

#get_test_keys(sku_id, headers = {}) ⇒ Object



9
10
11
12
13
14
# File 'lib/cruz/client/keys.rb', line 9

def get_test_keys(sku_id, headers = {})
  params = {
    skuId: sku_id
  }
  @client.rest_post_with_token('/testKeys', params, headers)
end

#trade_in(key_id, params = {}, headers = {}) ⇒ Object



28
29
30
# File 'lib/cruz/client/keys.rb', line 28

def trade_in(key_id, params = {}, headers = {})
  @client.rest_post_with_token("/keys/#{key_id}/trade_in", params, headers)
end