Class: Poundpay::Resource
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- Poundpay::Resource
- Defined in:
- lib/poundpay/resource.rb
Direct Known Subclasses
Class Attribute Summary collapse
Class Method Summary collapse
-
.collection_path(prefix_options = {}, query_options = nil) ⇒ Object
Modified default to not use an extension.
-
.custom_method_collection_url(method_name, options = {}) ⇒ Object
Modified default to not use an extension.
-
.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object
Modified default to not use an extension.
-
.instantiate_collection(collection, prefix_options = {}) ⇒ Object
Handle paginated collections.
-
.new_element_path(prefix_options = {}) ⇒ Object
Modified default to not use an extension.
Instance Method Summary collapse
- #collection_name ⇒ Object
-
#encode ⇒ Object
Poundpay accepts urlencoded form parameters Ideally we should override this functionality in the format, but it’s not very straightforward to do so.
Class Attribute Details
.primary_key ⇒ Object
12 13 14 |
# File 'lib/poundpay/resource.rb', line 12 def primary_key @primary_key ||= 'sid' end |
Class Method Details
.collection_path(prefix_options = {}, query_options = nil) ⇒ Object
Modified default to not use an extension
29 30 31 32 |
# File 'lib/poundpay/resource.rb', line 29 def collection_path( = {}, = nil) path = super(, ) remove_extension(path) end |
.custom_method_collection_url(method_name, options = {}) ⇒ Object
Modified default to not use an extension
35 36 37 38 |
# File 'lib/poundpay/resource.rb', line 35 def custom_method_collection_url(method_name, = {}) path = super(method_name, ) remove_extension(path) end |
.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object
Modified default to not use an extension
17 18 19 20 |
# File 'lib/poundpay/resource.rb', line 17 def element_path(id, = {}, = nil) path = super(id, , ) remove_extension(path) end |
.instantiate_collection(collection, prefix_options = {}) ⇒ Object
Handle paginated collections
41 42 43 44 45 |
# File 'lib/poundpay/resource.rb', line 41 def instantiate_collection(collection, = {}) # TODO: Consume pages collection = collection[collection_name] super(collection, ) end |
.new_element_path(prefix_options = {}) ⇒ Object
Modified default to not use an extension
23 24 25 26 |
# File 'lib/poundpay/resource.rb', line 23 def new_element_path( = {}) path = super() remove_extension(path) end |
Instance Method Details
#collection_name ⇒ Object
59 60 61 |
# File 'lib/poundpay/resource.rb', line 59 def collection_name self.class.collection_name end |
#encode ⇒ Object
Poundpay accepts urlencoded form parameters Ideally we should override this functionality in the format, but it’s not very straightforward to do so
55 56 57 |
# File 'lib/poundpay/resource.rb', line 55 def encode Resource.urlencode(@attributes) end |