Class: Poundpay::Resource

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/poundpay/resource.rb

Direct Known Subclasses

ChargePermission, Developer, Payment, User

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.collection_path(prefix_options = {}, query_options = nil) ⇒ Object

Modified default to not use an extension



25
26
27
28
# File 'lib/poundpay/resource.rb', line 25

def collection_path(prefix_options = {}, query_options = nil)
  path = super(prefix_options, query_options)
  remove_extension(path)
end

.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object

Modified default to not use an extension



13
14
15
16
# File 'lib/poundpay/resource.rb', line 13

def element_path(id, prefix_options = {}, query_options = nil)
  path = super(id, prefix_options, query_options)
  remove_extension(path)
end

.instantiate_collection(collection, prefix_options = {}) ⇒ Object

Handle paginated collections



31
32
33
34
35
# File 'lib/poundpay/resource.rb', line 31

def instantiate_collection(collection, prefix_options = {})
  # TODO: Consume pages
  collection = collection[collection_name]
  super(collection, prefix_options)
end

.new_element_path(prefix_options = {}) ⇒ Object

Modified default to not use an extension



19
20
21
22
# File 'lib/poundpay/resource.rb', line 19

def new_element_path(prefix_options = {})
  path = super(prefix_options)
  remove_extension(path)
end

Instance Method Details

#collection_nameObject



49
50
51
# File 'lib/poundpay/resource.rb', line 49

def collection_name
  self.class.collection_name
end

#encodeObject

Poundpay accepts urlencoded form parameters Ideally we should override this functionality in the format, but it’s not very straightforward to do so



45
46
47
# File 'lib/poundpay/resource.rb', line 45

def encode
  urlencode(@attributes)
end