Class: Mpayer::Endpoint
- Inherits:
-
Object
- Object
- Mpayer::Endpoint
- Defined in:
- lib/mpayer_ruby/endpoints/_endpoint.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#config ⇒ Object
Returns the value of attribute config.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#id ⇒ Object
Returns the value of attribute id.
-
#pagination ⇒ Object
Returns the value of attribute pagination.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(config: nil, **keyword_args) ⇒ Endpoint
constructor
Mpayer::Model.new(options={}).
- #success? ⇒ Boolean
Constructor Details
#initialize(config: nil, **keyword_args) ⇒ Endpoint
Mpayer::Model.new(options={})
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/mpayer_ruby/endpoints/_endpoint.rb', line 7 def initialize(config:nil,**keyword_args) @attributes = Hashie::Mash.new(keyword_args) keyword_args.each do |k,v| self.send("#{k.to_s}=",v) rescue nil end @config = set_config(config) # @is_new ||= true @pagination ||= {} after_initialize end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object (protected)
94 95 96 97 98 99 100 |
# File 'lib/mpayer_ruby/endpoints/_endpoint.rb', line 94 def method_missing(m, *args, &block) if @response.is_a?(Hash) @response.keys.include?(m.to_s) ? @response.send(m) : super else super end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/mpayer_ruby/endpoints/_endpoint.rb', line 3 def attributes @attributes end |
#config ⇒ Object
Returns the value of attribute config.
3 4 5 |
# File 'lib/mpayer_ruby/endpoints/_endpoint.rb', line 3 def config @config end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
3 4 5 |
# File 'lib/mpayer_ruby/endpoints/_endpoint.rb', line 3 def endpoint @endpoint end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/mpayer_ruby/endpoints/_endpoint.rb', line 4 def id @id end |
#pagination ⇒ Object
Returns the value of attribute pagination.
3 4 5 |
# File 'lib/mpayer_ruby/endpoints/_endpoint.rb', line 3 def pagination @pagination end |
#response ⇒ Object
Returns the value of attribute response.
3 4 5 |
# File 'lib/mpayer_ruby/endpoints/_endpoint.rb', line 3 def response @response end |
Instance Method Details
#success? ⇒ Boolean
23 24 25 |
# File 'lib/mpayer_ruby/endpoints/_endpoint.rb', line 23 def success? !response.code.to_s.match(/\A2\d+/).to_s.empty? rescue false end |