Class: VaucharAPI::Base
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- VaucharAPI::Base
show all
- Defined in:
- lib/vauchar_api/resources/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.init_prefix(resource) ⇒ Object
27
28
29
|
# File 'lib/vauchar_api/resources/base.rb', line 27
def init_prefix(resource)
init_prefix_explicit(resource.to_s.pluralize, "#{resource}_id")
end
|
.init_prefix_explicit(resource_type, resource_id) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/vauchar_api/resources/base.rb', line 31
def init_prefix_explicit(resource_type, resource_id)
self.prefix = "/#{resource_type}/:#{resource_id}/"
define_method resource_id.to_sym do
@prefix_options[resource_id]
end
end
|
.password ⇒ Object
23
24
25
|
# File 'lib/vauchar_api/resources/base.rb', line 23
def password
Configuration.api_key
end
|
.user ⇒ Object
19
20
21
|
# File 'lib/vauchar_api/resources/base.rb', line 19
def user
Configuration.merchant_id
end
|
Instance Method Details
#accepts_attributes ⇒ Object
9
|
# File 'lib/vauchar_api/resources/base.rb', line 9
def accepts_attributes; nil; end
|
#encode(options = {}) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/vauchar_api/resources/base.rb', line 11
def encode(options = {})
same = dup
p accepts_attributes
same.attributes = same.attributes.slice(*accepts_attributes) if (accepts_attributes)
same.send("to_#{self.class.format.extension}", options)
end
|