Class: Bulkippt::FakeService
- Inherits:
-
Object
- Object
- Bulkippt::FakeService
- Defined in:
- lib/bulkippt/fake_service.rb
Instance Attribute Summary collapse
-
#clips ⇒ Object
readonly
Returns the value of attribute clips.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #account ⇒ Object
- #credentials_valid?(username, token) ⇒ Boolean
-
#initialize(username, token) ⇒ FakeService
constructor
A new instance of FakeService.
Constructor Details
#initialize(username, token) ⇒ FakeService
Returns a new instance of FakeService.
10 11 12 13 14 |
# File 'lib/bulkippt/fake_service.rb', line 10 def initialize(username, token) @username = username @token = token @clips = Clips.new end |
Instance Attribute Details
#clips ⇒ Object (readonly)
Returns the value of attribute clips.
8 9 10 |
# File 'lib/bulkippt/fake_service.rb', line 8 def clips @clips end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
8 9 10 |
# File 'lib/bulkippt/fake_service.rb', line 8 def token @token end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
8 9 10 |
# File 'lib/bulkippt/fake_service.rb', line 8 def username @username end |
Instance Method Details
#account ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/bulkippt/fake_service.rb', line 16 def account if credentials_valid?(@username, @token) {username: @username, token: @token}.to_json else raise Kippt::APIError, "Can't find an user with this username and api_key" end end |
#credentials_valid?(username, token) ⇒ Boolean
24 25 26 27 |
# File 'lib/bulkippt/fake_service.rb', line 24 def credentials_valid?(username, token) return false if username != 'valid' && @token != 'valid' true end |