class Paybase::Resource

Attributes

data[R]
rels[R]

Public Class Methods

new(client, data) click to toggle source
# File lib/paybase/resource.rb, line 6
def initialize(client, data)
  data = {} unless data.is_a?(Hash)

  @client = client

  data = data.with_indifferent_access

  links        = data.delete(:links) { ActiveSupport::HashWithIndifferentAccess.new }
  links[:self] = { href: data.delete(:href) } if data.has_key?(:href)

  @data   = OpenStruct.new(data.with_indifferent_access)

  @rels = parse_links(links)
end

Public Instance Methods

method_missing(method_sym, *arguments, &block) click to toggle source
Calls superclass method
# File lib/paybase/resource.rb, line 27
def method_missing(method_sym, *arguments, &block)
  if @data.respond_to?(method_sym)
    @data.send(method_sym)
  else
    super
  end
end