Module: Cryptopay

Defined in:
lib/cryptopay.rb,
lib/cryptopay/net.rb,
lib/cryptopay/version.rb

Defined Under Namespace

Modules: Request Classes: Error

Constant Summary collapse

VERSION =
"0.0.4"
@@api_key =

API Key

''

Class Method Summary collapse

Class Method Details

.configured?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/cryptopay.rb', line 29

def self.configured?
  self.key
end

.invoice(uuid) ⇒ Object



25
26
27
# File 'lib/cryptopay.rb', line 25

def self.invoice uuid
  Cryptopay::Request.get "invoices/#{uuid}"
end

.keyObject



15
16
17
# File 'lib/cryptopay.rb', line 15

def self.key
  @@api_key
end

.key=(new_key) ⇒ Object



11
12
13
# File 'lib/cryptopay.rb', line 11

def self.key=(new_key)
  @@api_key = new_key
end

.new_invoice(params = {}) ⇒ Object



19
20
21
22
23
# File 'lib/cryptopay.rb', line 19

def self.new_invoice(params = {})
  sanity_check!

  Cryptopay::Request.post 'invoices', params
end

.sanity_check!Object



33
34
35
36
37
# File 'lib/cryptopay.rb', line 33

def self.sanity_check!
  unless configured?
    raise Exception.new("Cryptopay Gem not properly configured")
  end
end