netology-tasks_client 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cf94c9d49cfdf80e9eafc346fb01965e781c0e555e46bb0608b2854b59f6ec0
4
- data.tar.gz: a5ad538d0bbe04b0b46a70dbf3ac08e6cad79e03d95ffca6d6d13dac8350a437
3
+ metadata.gz: 19340c7a4a4fdb713bc648d58b634568f78151cc90761e17416ccac649f856b1
4
+ data.tar.gz: da3b25a9c3ce9928a1330542bc3a3681786464a5a09db9d825450dd62f2b2673
5
5
  SHA512:
6
- metadata.gz: 1651ba2a09636a795a7542f1f6b5ee6b723e678073698adc76f891b5b388d699ae26253ab9bc56d9db8aa88d2b41f3d9734fec047f5de10c21810e7305ff9d74
7
- data.tar.gz: a74288b67627b20a11fede51b434d4a7f2942871c7b5b258f5dd36b7738ff13d5ece7aec1ee196ab3b872957d5f0372c95c5e45f887a189ef4dfbfa23b57e99a
6
+ metadata.gz: 4b4b49589ba6b8c52718bd245561b9b7171466104df7eb82d23c4859902ef8ac5bbeb5a720bfb74daf9918583a6f041b3fa73b775d53757a7359db462fa08f2d
7
+ data.tar.gz: 5380cd57b47722cd408be6dc9834bb29f7b856660c4ec9f1e7129d0608c24845989c58a79753c9c3fc2bd658ed1b98d8e489fcd13f317216ece047152c65ebea
data/README.md CHANGED
@@ -1,21 +1,40 @@
1
1
  # NetologyGroup::TasksClient
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/netology_group/tasks_client`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ ## Установка
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
5
+ ```ruby
6
+ gem 'netology-tasks_client'
7
+ ```
8
8
 
9
- Add this line to your application's Gemfile:
9
+ ##### Пример использования:
10
10
 
11
11
  ```ruby
12
- gem 'netology-tasks_client'
12
+ def index
13
+ response = NetologyGroup::TasksClient.tasks_list
14
+ render json: response.body, status: response.status
15
+ end
13
16
  ```
14
17
 
15
- And then execute:
18
+ Для того, чтобы убрать правильные ответы и подсказки из задачи нужно вызывать метод `secure_answers`:
19
+
20
+ ```ruby
21
+ response = NetologyGroup::TasksClient.find_task(1)
22
+ render json: response.secure_answers.body
23
+ ```
16
24
 
17
- $ bundle
25
+ Также можно указать сколько оставиить подсказок (по-умолчанию `0`)
26
+ ```ruby
27
+ render json: response.secure_answers.hints_limit(1).body
28
+ ```
29
+ Или поставить лимит на подсказки, оставив правильные ответы
30
+ ```ruby
31
+ render json: response.hints_limit(1).body
32
+ ```
18
33
 
19
- Or install it yourself as:
34
+ ##### Пагинация:
20
35
 
21
- $ gem install netolog-tasks_client
36
+ ```ruby
37
+ response = NetologyGroup.tasks_list(page: 1)
38
+ @next_page_number = response.next_page
39
+ @previous_page_number = response.previous_page
40
+ ```
@@ -11,6 +11,7 @@ module NetologyGroup
11
11
  # Скрыть правильные ответы и подсказки
12
12
  def secure_answers
13
13
  delete_correct_answers
14
+ delete_solution
14
15
  set_hints_limit(0)
15
16
  self
16
17
  end
@@ -30,6 +31,10 @@ module NetologyGroup
30
31
  end
31
32
  end
32
33
 
34
+ def delete_solution
35
+ body.delete('solution')
36
+ end
37
+
33
38
  def set_hints_limit(limit)
34
39
  body['hints'] = original_body['hints']&.take(limit)
35
40
  end
@@ -1,5 +1,5 @@
1
1
  module NetologyGroup
2
2
  module TasksClient
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netology-tasks_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Skuryatin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-21 00:00:00.000000000 Z
11
+ date: 2018-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby