Class: Passninja::PassTemplates

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

Instance Method Summary collapse

Constructor Details

#initialize(account_id, api_key) ⇒ PassTemplates

Returns a new instance of PassTemplates.



21
22
23
24
# File 'lib/passninja.rb', line 21

def initialize(, api_key)
  @account_id = 
  @api_key = api_key
end

Instance Method Details

#find(pass_template_key) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/passninja.rb', line 26

def find(pass_template_key)
  uri = URI("https://api.passninja.com/v1/pass_templates/#{pass_template_key}")
  request = Net::HTTP::Get.new(uri)
  request.basic_auth(@account_id, @api_key)

  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
  end

  JSON.parse(response.body)
end