Module: Kojn

Defined in:
lib/kojn.rb,
lib/kojn/ipn.rb,
lib/kojn/net.rb,
lib/kojn/model.rb,
lib/kojn/crypto.rb,
lib/kojn/invoice.rb,
lib/kojn/net_old.rb,
lib/kojn/version.rb,
lib/kojn/collection.rb,
lib/kojn/transaction.rb

Defined Under Namespace

Modules: Net Classes: AuthenticityException, Collection, Crypto, Invoice, Invoices, Ipn, MissingConfigExecption, Model, Transactions, Tx

Constant Summary collapse

VERSION =
"0.0.2"
@@ipn_sec =
:integrity
@@host =
"kojn.nl"
@@port =
80
@@ssl =
true
@@verbose =
false
@@verify_peer_and_host =
true

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object

Config setters/getters



76
77
78
# File 'lib/kojn.rb', line 76

def self.[](key)
  self.send(key)
end

.[]=(key, value) ⇒ Object



80
81
82
# File 'lib/kojn.rb', line 80

def self.[]=(key, value)
  self.send("#{key}=", value)
end

.cryptoObject



53
54
55
56
57
58
59
# File 'lib/kojn.rb', line 53

def self.crypto
  raise MissingConfigExecption.new("API key not set") unless self.api_key

  @@crypto ||= Kojn::Crypto.new

  return @@crypto
end

.invoicesObject



61
62
63
64
65
66
67
# File 'lib/kojn.rb', line 61

def self.invoices
  raise MissingConfigExecption.new("API key not set") unless self.api_key

  @@transacions ||= Kojn::Invoices.new

  return @@transacions
end

.ipn(params) ⇒ Object



69
70
71
72
73
# File 'lib/kojn.rb', line 69

def self.ipn(params)
  raise MissingConfigExecption.new("API key not set") unless self.api_key

  return Kojn::Ipn.new(params)
end

.parse_object!(object, klass) ⇒ Object



9
10
11
12
13
# File 'lib/kojn/transaction.rb', line 9

def self.parse_object!(object, klass)
  object = JSON.parse(object) if object.is_a? String

  klass.new(object)
end

.parse_objects!(string, klass) ⇒ Object



2
3
4
5
6
7
# File 'lib/kojn/transaction.rb', line 2

def self.parse_objects!(string, klass)
  objects = JSON.parse(string)
  objects.collect do |t_json|
    Kojn.parse_object!(t_json, klass)
  end
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Kojn)

    the object that the method was called on



84
85
86
# File 'lib/kojn.rb', line 84

def self.setup
  yield self
end