Class: Rexpense::Client
- Inherits:
-
Object
- Object
- Rexpense::Client
- Defined in:
- lib/rexpense/client.rb
Instance Attribute Summary collapse
-
#http ⇒ Object
readonly
Returns the value of attribute http.
Instance Method Summary collapse
-
#activities ⇒ Object
Define available endpoints.
- #advancement_devolutions ⇒ Object
- #authenticated? ⇒ Boolean
-
#initialize(token) ⇒ Client
constructor
A new instance of Client.
- #pre_expenses ⇒ Object
Constructor Details
Instance Attribute Details
#http ⇒ Object (readonly)
Returns the value of attribute http.
6 7 8 |
# File 'lib/rexpense/client.rb', line 6 def http @http end |
Instance Method Details
#activities ⇒ Object
Define available endpoints
21 22 23 |
# File 'lib/rexpense/client.rb', line 21 def activities Rexpense::Resources::Activity.new(http) end |
#advancement_devolutions ⇒ Object
25 26 27 |
# File 'lib/rexpense/client.rb', line 25 def advancement_devolutions Rexpense::Resources::AdvancementDevolution.new(http) end |
#authenticated? ⇒ Boolean
12 13 14 15 16 17 |
# File 'lib/rexpense/client.rb', line 12 def authenticated? http.get("/organizations") { |response| response.code == 200 } rescue RequestError => e raise e unless [401, 403].include?(e.code) false end |
#pre_expenses ⇒ Object
29 30 31 |
# File 'lib/rexpense/client.rb', line 29 def pre_expenses Rexpense::Resources::PreExpense.new(http) end |