pandarus 0.6.1 → 0.6.2
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.
- data/lib/pandarus/api_base.rb +17 -4
- data/lib/pandarus/models.rb +1 -1
- data/lib/pandarus/v1_api.rb +1100 -1914
- data/lib/pandarus/version.rb +1 -1
- data/pandarus.gemspec +1 -1
- data/spec/api_base_spec.rb +57 -0
- metadata +48 -29
- checksums.yaml +0 -7
- data/lib/pandarus/models/quiz_assignment_override_set_container.rb +0 -12
data/lib/pandarus/api_base.rb
CHANGED
@@ -31,18 +31,31 @@ module Pandarus
|
|
31
31
|
"#{method}:#{path}"
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
def parse_page_params!(url)
|
35
|
+
return nil if url.nil?
|
36
|
+
uri = URI.parse url
|
37
|
+
Hash[URI.decode_www_form(uri.query)]
|
38
38
|
rescue URI::InvalidURIError
|
39
39
|
nil
|
40
40
|
end
|
41
41
|
|
42
|
+
def page_params_store(method, path, response=@response.env)
|
43
|
+
@pagination_params[remember_key(method, path)] = {
|
44
|
+
next: parse_page_params!(response[:next_page]),
|
45
|
+
current: parse_page_params!(response[:current_page]),
|
46
|
+
last: parse_page_params!(response[:last_page])
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
42
50
|
def page_params_load(method, path)
|
43
51
|
@pagination_params[remember_key(method, path)]
|
44
52
|
end
|
45
53
|
|
54
|
+
def was_last_page?(method, path)
|
55
|
+
params = @pagination_params[remember_key(method, path)]
|
56
|
+
return false if params.nil? || params[:current].nil? || params[:last].nil?
|
57
|
+
return (params[:current] == params[:last])
|
58
|
+
end
|
46
59
|
|
47
60
|
def underscored_merge_opts(opts, base)
|
48
61
|
base.merge(opts).merge(underscored_flatten_hash(opts))
|
data/lib/pandarus/models.rb
CHANGED