Class: FilmwebApi
- Inherits:
-
Object
- Object
- FilmwebApi
- Defined in:
- lib/filmweb_api.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(method:, **attributes) ⇒ FilmwebApi
constructor
A new instance of FilmwebApi.
Constructor Details
#initialize(method:, **attributes) ⇒ FilmwebApi
Returns a new instance of FilmwebApi.
8 9 10 11 |
# File 'lib/filmweb_api.rb', line 8 def initialize(method:, **attributes) @method = method @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/filmweb_api.rb', line 6 def attributes @attributes end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
6 7 8 |
# File 'lib/filmweb_api.rb', line 6 def method @method end |
Instance Method Details
#get ⇒ Object
13 14 15 16 17 |
# File 'lib/filmweb_api.rb', line 13 def get raise ArgumentError.new("Passed method not supported") unless method_defined? raise ArgumentError.new("You need to pass all required attributes for that method") unless correct_attributes_for_method? method_handler.new(attributes.slice(*method_handler::REQUEST_ATTRIBUTES)).call end |