api_queries 0.1.1 → 0.1.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.
- checksums.yaml +4 -4
- data/.rspec_status +8 -8
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -20
- data/LICENSE.txt +17 -16
- data/README.md +15 -14
- data/api_queries.gemspec +4 -6
- data/lib/api_queries/version.rb +1 -1
- data/lib/api_queries.rb +3 -3
- metadata +6 -40
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a784c65519534749828e864a0cb353f8fd4fdc34dcafebe8085035403b89c4c
|
|
4
|
+
data.tar.gz: e86f531346df5af87b839bb83c2eb4b3d33970540d32c4b47d4f45576ee7aa00
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 52e46788a77bf9a48b582afb747f90f006486337c54b86e0961908b86c818f2164b3765d07114ef55938ac7afcdd4d02f6a5616f683e27cafafbfc005a773717
|
|
7
|
+
data.tar.gz: ff5a372bc13363afa9c658415f8f66e29857b8b4cd0d98488b5e34a8bc1cf6c121141e13f3f93555ba500b5980fbb7cce8170321c5923ae7fc46f0ddb63e4a45
|
data/.rspec_status
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
example_id | status | run_time |
|
|
2
2
|
--------------------------------- | ------ | --------------- |
|
|
3
|
-
./spec/api_queries_spec.rb[1:1:1] | passed | 0.
|
|
4
|
-
./spec/api_queries_spec.rb[1:1:2] | passed | 0.
|
|
5
|
-
./spec/api_queries_spec.rb[1:1:3] | passed | 0.
|
|
6
|
-
./spec/api_queries_spec.rb[1:1:4] | passed | 0.
|
|
7
|
-
./spec/api_queries_spec.rb[1:1:5] | passed | 0.
|
|
8
|
-
./spec/api_queries_spec.rb[1:1:6] | passed | 0.
|
|
9
|
-
./spec/api_queries_spec.rb[1:1:7] | passed | 0.
|
|
10
|
-
./spec/api_queries_spec.rb[1:1:8] | passed | 0.
|
|
3
|
+
./spec/api_queries_spec.rb[1:1:1] | passed | 0.00709 seconds |
|
|
4
|
+
./spec/api_queries_spec.rb[1:1:2] | passed | 0.01412 seconds |
|
|
5
|
+
./spec/api_queries_spec.rb[1:1:3] | passed | 0.00078 seconds |
|
|
6
|
+
./spec/api_queries_spec.rb[1:1:4] | passed | 0.00538 seconds |
|
|
7
|
+
./spec/api_queries_spec.rb[1:1:5] | passed | 0.00631 seconds |
|
|
8
|
+
./spec/api_queries_spec.rb[1:1:6] | passed | 0.00298 seconds |
|
|
9
|
+
./spec/api_queries_spec.rb[1:1:7] | passed | 0.00328 seconds |
|
|
10
|
+
./spec/api_queries_spec.rb[1:1:8] | passed | 0.00775 seconds |
|
data/CODE_OF_CONDUCT.md
CHANGED
|
@@ -35,7 +35,7 @@ This code of conduct applies both within project spaces and in public spaces
|
|
|
35
35
|
when an individual is representing the project or its community.
|
|
36
36
|
|
|
37
37
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
38
|
-
reported by contacting a project maintainer at
|
|
38
|
+
reported by contacting a project maintainer at denmarkmeralpis@gmail.com. All
|
|
39
39
|
complaints will be reviewed and investigated and will result in a response that
|
|
40
40
|
is deemed necessary and appropriate to the circumstances. Maintainers are
|
|
41
41
|
obligated to maintain confidentiality with regard to the reporter of an
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
api_queries (0.1.
|
|
5
|
-
activerecord (
|
|
4
|
+
api_queries (0.1.2)
|
|
5
|
+
activerecord (~> 4.2)
|
|
6
6
|
will_paginate (~> 3.1)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
@@ -22,7 +22,6 @@ GEM
|
|
|
22
22
|
tzinfo (~> 1.1)
|
|
23
23
|
ansi (1.5.0)
|
|
24
24
|
arel (6.0.4)
|
|
25
|
-
ast (2.4.0)
|
|
26
25
|
builder (3.2.3)
|
|
27
26
|
concurrent-ruby (1.0.5)
|
|
28
27
|
diff-lcs (1.3)
|
|
@@ -30,15 +29,9 @@ GEM
|
|
|
30
29
|
hirb (0.7.3)
|
|
31
30
|
i18n (0.9.5)
|
|
32
31
|
concurrent-ruby (~> 1.0)
|
|
33
|
-
jaro_winkler (1.5.1)
|
|
34
32
|
json (2.1.0)
|
|
35
33
|
minitest (5.11.3)
|
|
36
34
|
mysql2 (0.3.21)
|
|
37
|
-
parallel (1.12.1)
|
|
38
|
-
parser (2.5.1.2)
|
|
39
|
-
ast (~> 2.4.0)
|
|
40
|
-
powerpack (0.1.2)
|
|
41
|
-
rainbow (3.0.0)
|
|
42
35
|
rake (10.5.0)
|
|
43
36
|
rspec (3.7.0)
|
|
44
37
|
rspec-core (~> 3.7.0)
|
|
@@ -53,15 +46,6 @@ GEM
|
|
|
53
46
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
54
47
|
rspec-support (~> 3.7.0)
|
|
55
48
|
rspec-support (3.7.1)
|
|
56
|
-
rubocop (0.58.1)
|
|
57
|
-
jaro_winkler (~> 1.5.1)
|
|
58
|
-
parallel (~> 1.10)
|
|
59
|
-
parser (>= 2.5, != 2.5.1.1)
|
|
60
|
-
powerpack (~> 0.1)
|
|
61
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
62
|
-
ruby-progressbar (~> 1.7)
|
|
63
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
64
|
-
ruby-progressbar (1.9.0)
|
|
65
49
|
simplecov (0.16.1)
|
|
66
50
|
docile (~> 1.1)
|
|
67
51
|
json (>= 1.8, < 3)
|
|
@@ -74,7 +58,6 @@ GEM
|
|
|
74
58
|
thread_safe (0.3.6)
|
|
75
59
|
tzinfo (1.2.5)
|
|
76
60
|
thread_safe (~> 0.1)
|
|
77
|
-
unicode-display_width (1.4.0)
|
|
78
61
|
will_paginate (3.1.6)
|
|
79
62
|
|
|
80
63
|
PLATFORMS
|
|
@@ -87,7 +70,6 @@ DEPENDENCIES
|
|
|
87
70
|
mysql2 (>= 0.3.13, < 0.4.0)
|
|
88
71
|
rake (~> 10.0)
|
|
89
72
|
rspec (~> 3.0)
|
|
90
|
-
rubocop
|
|
91
73
|
simplecov
|
|
92
74
|
simplecov-console
|
|
93
75
|
|
data/LICENSE.txt
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2016
|
|
3
|
+
Copyright (c) 2016-2018 Nujian Den Mark Meralpis
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
of this software and associated documentation files (the
|
|
7
|
-
in the Software without restriction, including
|
|
8
|
-
to use, copy, modify, merge, publish,
|
|
9
|
-
copies of the Software, and to
|
|
10
|
-
furnished to do so, subject to
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
11
12
|
|
|
12
|
-
The above copyright notice and this permission notice shall be
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
14
15
|
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE.
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://travis-ci.org/denmarkmeralpis/api_queries) [](https://codeclimate.com/github/denmarkmeralpis/api_queries/maintainability) [](https://codeclimate.com/github/denmarkmeralpis/api_queries/test_coverage)
|
|
1
|
+
[](https://travis-ci.org/denmarkmeralpis/api_queries) [](https://codeclimate.com/github/denmarkmeralpis/api_queries/maintainability) [](https://codeclimate.com/github/denmarkmeralpis/api_queries/test_coverage) [](https://badge.fury.io/rb/api_queries)
|
|
2
2
|
# ApiQueries
|
|
3
3
|
|
|
4
4
|
Manage you api using `api_q` method.
|
|
@@ -9,7 +9,6 @@ Add this line to your application's Gemfile:
|
|
|
9
9
|
|
|
10
10
|
```ruby
|
|
11
11
|
gem 'api_queries'
|
|
12
|
-
gem 'will_paginate', '~> 3.1.0'
|
|
13
12
|
```
|
|
14
13
|
|
|
15
14
|
And then execute:
|
|
@@ -44,30 +43,29 @@ Available Queries:
|
|
|
44
43
|
|
|
45
44
|
Example:
|
|
46
45
|
```ruby
|
|
46
|
+
# models/product.rb
|
|
47
|
+
class Product < ActiveRecord::Base
|
|
48
|
+
include ApiQueries
|
|
49
|
+
end
|
|
50
|
+
|
|
47
51
|
# Get active products(assuming you have a status column)
|
|
48
|
-
Product.api_q(
|
|
52
|
+
Product.api_q(active_only: 1)
|
|
49
53
|
|
|
50
54
|
# Get active products and go to page 2
|
|
51
|
-
Product.api_q(
|
|
55
|
+
Product.api_q(active_only: 1, page: 2)
|
|
52
56
|
|
|
53
57
|
# Get all dates using from and to
|
|
54
58
|
# Date format should be: YYYY-MM-DDTHH:MM:SSZ
|
|
55
|
-
Product.api_q(
|
|
59
|
+
Product.api_q(from: '2016-01-01T12:00:00Z', to: '2016-01-31T12:00:00Z')
|
|
56
60
|
|
|
57
61
|
# Count all products
|
|
58
|
-
Product.api_q(
|
|
62
|
+
Product.api_q(q: 'count')
|
|
59
63
|
|
|
60
64
|
# Get last updated_at
|
|
61
|
-
Product.api_q(
|
|
65
|
+
Product.api_q(q: 'last_updated_at')
|
|
62
66
|
|
|
63
67
|
```
|
|
64
68
|
|
|
65
|
-
## Development
|
|
66
|
-
|
|
67
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
68
|
-
|
|
69
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
70
|
-
|
|
71
69
|
## Contributing
|
|
72
70
|
|
|
73
71
|
Bug reports and pull requests are welcome on GitHub at https://github.com/denmarkmeralpis/api_queries. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
@@ -75,5 +73,8 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/denmar
|
|
|
75
73
|
|
|
76
74
|
## License
|
|
77
75
|
|
|
78
|
-
The gem is available as open source under the terms of the [MIT License](
|
|
76
|
+
The gem is available as open source under the terms of the [MIT License](https://github.com/denmarkmeralpis/api_queries/blob/master/LICENSE.txt).
|
|
77
|
+
|
|
78
|
+
## Donate
|
|
79
79
|
|
|
80
|
+
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=nujiandenmarkmeralpis@gmail.com&lc=US&item_name=For+Living&no_note=0&cn=&curency_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted)
|
data/api_queries.gemspec
CHANGED
|
@@ -5,8 +5,8 @@ require 'api_queries/version'
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = 'api_queries'
|
|
7
7
|
spec.version = ApiQueries::VERSION
|
|
8
|
-
spec.authors = ['
|
|
9
|
-
spec.email = ['
|
|
8
|
+
spec.authors = ['Nujian Den Mark Meralpis']
|
|
9
|
+
spec.email = ['denmarkmeralpis@gmail.com']
|
|
10
10
|
|
|
11
11
|
spec.summary = 'This will wrap all the api methods in just a single call.'
|
|
12
12
|
spec.description = 'A lightweight rails plugin that is very useful for developers.'
|
|
@@ -24,12 +24,10 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
25
25
|
spec.require_paths = ['lib']
|
|
26
26
|
|
|
27
|
-
spec.add_dependency 'activerecord', '
|
|
27
|
+
spec.add_dependency 'activerecord', '~> 4.2'
|
|
28
28
|
spec.add_dependency 'will_paginate', '~> 3.1'
|
|
29
29
|
spec.add_development_dependency 'activesupport', '~> 4.2'
|
|
30
30
|
spec.add_development_dependency 'bundler', '~> 1.12'
|
|
31
|
-
spec.add_development_dependency 'mysql2', '>= 0.3.13', '< 0.4.0'
|
|
32
31
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
33
32
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
34
|
-
|
|
35
|
-
end
|
|
33
|
+
end
|
data/lib/api_queries/version.rb
CHANGED
data/lib/api_queries.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
require 'active_support'
|
|
1
|
+
require 'active_support/core_ext/string/conversions'
|
|
2
2
|
require 'api_queries/version'
|
|
3
|
-
|
|
4
3
|
# ApiQueries
|
|
5
4
|
module ApiQueries
|
|
6
5
|
extend ActiveSupport::Concern
|
|
@@ -53,7 +52,8 @@ module ApiQueries
|
|
|
53
52
|
private
|
|
54
53
|
|
|
55
54
|
def fdate(date_string)
|
|
56
|
-
Date.strptime(date_string, '%Y-%m-%dT%H:%M:%SZ') # YYYY-MM-DDTHH:MM:SSZ
|
|
55
|
+
# Date.strptime(date_string, '%Y-%m-%dT%H:%M:%SZ') # YYYY-MM-DDTHH:MM:SSZ
|
|
56
|
+
date_string.to_datetime
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
extend ClassMethods
|
metadata
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: api_queries
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Nujian Den Mark Meralpis
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-07-
|
|
11
|
+
date: 2018-07-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '4.2'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '4.2'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
@@ -66,26 +66,6 @@ dependencies:
|
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '1.12'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: mysql2
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - ">="
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.3.13
|
|
76
|
-
- - "<"
|
|
77
|
-
- !ruby/object:Gem::Version
|
|
78
|
-
version: 0.4.0
|
|
79
|
-
type: :development
|
|
80
|
-
prerelease: false
|
|
81
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
82
|
-
requirements:
|
|
83
|
-
- - ">="
|
|
84
|
-
- !ruby/object:Gem::Version
|
|
85
|
-
version: 0.3.13
|
|
86
|
-
- - "<"
|
|
87
|
-
- !ruby/object:Gem::Version
|
|
88
|
-
version: 0.4.0
|
|
89
69
|
- !ruby/object:Gem::Dependency
|
|
90
70
|
name: rake
|
|
91
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -114,23 +94,9 @@ dependencies:
|
|
|
114
94
|
- - "~>"
|
|
115
95
|
- !ruby/object:Gem::Version
|
|
116
96
|
version: '3.0'
|
|
117
|
-
- !ruby/object:Gem::Dependency
|
|
118
|
-
name: rubocop
|
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
|
120
|
-
requirements:
|
|
121
|
-
- - ">="
|
|
122
|
-
- !ruby/object:Gem::Version
|
|
123
|
-
version: '0'
|
|
124
|
-
type: :development
|
|
125
|
-
prerelease: false
|
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
127
|
-
requirements:
|
|
128
|
-
- - ">="
|
|
129
|
-
- !ruby/object:Gem::Version
|
|
130
|
-
version: '0'
|
|
131
97
|
description: A lightweight rails plugin that is very useful for developers.
|
|
132
98
|
email:
|
|
133
|
-
-
|
|
99
|
+
- denmarkmeralpis@gmail.com
|
|
134
100
|
executables: []
|
|
135
101
|
extensions: []
|
|
136
102
|
extra_rdoc_files: []
|