Class: Fortnox::API::Repository::Base
- Inherits:
-
Object
- Object
- Fortnox::API::Repository::Base
- Includes:
- Loaders, Savers, Fortnox::API::RequestHandling, HTTParty
- Defined in:
- lib/fortnox/api/repositories/base.rb
Constant Summary collapse
- HTTP_METHODS =
%i[get put post delete].freeze
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#keys_filtered_on_save ⇒ Object
readonly
Returns the value of attribute keys_filtered_on_save.
-
#mapper ⇒ Object
readonly
Returns the value of attribute mapper.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(keys_filtered_on_save: [:url]) ⇒ Base
constructor
A new instance of Base.
Methods included from Savers
Methods included from Loaders
#all, #escape, #find, #find_all_by, #find_one_by, #only, #search, #to_query
Constructor Details
#initialize(keys_filtered_on_save: [:url]) ⇒ Base
Returns a new instance of Base.
51 52 53 54 55 56 57 58 59 |
# File 'lib/fortnox/api/repositories/base.rb', line 51 def initialize(keys_filtered_on_save: [:url]) @keys_filtered_on_save = keys_filtered_on_save @mapper = Registry[Mapper::Base.canonical_name_sym(self.class::MODEL)].new return unless access_token.nil? raise MissingAccessToken, 'No Access Token provided! You need to provide an Access Token: ' \ 'Fortnox::API.access_token = token' end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
29 30 31 |
# File 'lib/fortnox/api/repositories/base.rb', line 29 def headers @headers end |
#keys_filtered_on_save ⇒ Object (readonly)
Returns the value of attribute keys_filtered_on_save.
30 31 32 |
# File 'lib/fortnox/api/repositories/base.rb', line 30 def keys_filtered_on_save @keys_filtered_on_save end |
#mapper ⇒ Object (readonly)
Returns the value of attribute mapper.
30 31 32 |
# File 'lib/fortnox/api/repositories/base.rb', line 30 def mapper @mapper end |
Class Method Details
.set_headers(headers = {}) ⇒ Object
32 33 34 |
# File 'lib/fortnox/api/repositories/base.rb', line 32 def self.set_headers(headers = {}) self.headers.merge!(headers) end |