Class: FriendlyScore::API
- Inherits:
-
Object
- Object
- FriendlyScore::API
- Defined in:
- lib/friendly_score/api.rb
Instance Attribute Summary collapse
-
#application_id ⇒ Object
readonly
Returns the value of attribute application_id.
-
#application_secret ⇒ Object
readonly
Returns the value of attribute application_secret.
Instance Method Summary collapse
-
#initialize(application_id, application_secret) ⇒ API
constructor
A new instance of API.
-
#show(id) ⇒ FriendlyScore::User
Returns user data (api: ‘api/show’).
-
#show_partner_user(partner_user_id) ⇒ FriendlyScore::User
Returns partner user.
-
#user_positive(id, positive) ⇒ Object
Sets is user positive or not.
-
#user_status(id, status, status_description) ⇒ Object
Sets users status with description.
-
#users ⇒ List<FriendlyScore::User>
List of all application users.
Constructor Details
#initialize(application_id, application_secret) ⇒ API
A new instance of API.
9 10 11 12 |
# File 'lib/friendly_score/api.rb', line 9 def initialize application_id, application_secret @application_id = application_id @application_secret = application_secret end |
Instance Attribute Details
#application_id ⇒ Object (readonly)
Returns the value of attribute application_id.
3 4 5 |
# File 'lib/friendly_score/api.rb', line 3 def application_id @application_id end |
#application_secret ⇒ Object (readonly)
Returns the value of attribute application_secret.
3 4 5 |
# File 'lib/friendly_score/api.rb', line 3 def application_secret @application_secret end |
Instance Method Details
#show(id) ⇒ FriendlyScore::User
Returns user data (api: ‘api/show’)
18 19 20 21 |
# File 'lib/friendly_score/api.rb', line 18 def show id endpoint = get_endpoint Endpoints::Show endpoint.perform id end |
#show_partner_user(partner_user_id) ⇒ FriendlyScore::User
Returns partner user
27 28 29 30 |
# File 'lib/friendly_score/api.rb', line 27 def show_partner_user partner_user_id endpoint = get_endpoint Endpoints::ShowPartnerUser endpoint.perform partner_user_id end |
#user_positive(id, positive) ⇒ Object
Sets is user positive or not
36 37 38 39 40 |
# File 'lib/friendly_score/api.rb', line 36 def user_positive id, positive endpoint = get_endpoint Endpoints::UserPositive endpoint.validate id, positive endpoint.perform id, positive end |
#user_status(id, status, status_description) ⇒ Object
Sets users status with description
47 48 49 50 |
# File 'lib/friendly_score/api.rb', line 47 def user_status id, status, status_description endpoint = get_endpoint Endpoints::UserStatus endpoint.perform id, status, status_description end |
#users ⇒ List<FriendlyScore::User>
List of all application users
55 56 57 58 |
# File 'lib/friendly_score/api.rb', line 55 def users endpoint = get_endpoint Endpoints::Users endpoint.perform end |