testdroid-api-client-updated 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.travis.yml +11 -0
- data/.whitesource +15 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +104 -0
- data/LICENSE +20 -0
- data/README.md +82 -0
- data/Rakefile +9 -0
- data/lib/testdroid-api-client.rb +36 -0
- data/lib/testdroid-api-filter-builder.rb +145 -0
- data/lib/testdroid_api/admin.rb +25 -0
- data/lib/testdroid_api/admin_device_models.rb +10 -0
- data/lib/testdroid_api/admin_device_problems.rb +9 -0
- data/lib/testdroid_api/admin_device_statuses.rb +12 -0
- data/lib/testdroid_api/admin_devices.rb +10 -0
- data/lib/testdroid_api/apikey_client.rb +120 -0
- data/lib/testdroid_api/client.rb +161 -0
- data/lib/testdroid_api/cloud_list_resource.rb +82 -0
- data/lib/testdroid_api/cloud_resource.rb +89 -0
- data/lib/testdroid_api/device_groups.rb +12 -0
- data/lib/testdroid_api/device_session_connections.rb +10 -0
- data/lib/testdroid_api/device_sessions.rb +23 -0
- data/lib/testdroid_api/devices.rb +10 -0
- data/lib/testdroid_api/files.rb +62 -0
- data/lib/testdroid_api/frameworks.rb +11 -0
- data/lib/testdroid_api/label_groups.rb +12 -0
- data/lib/testdroid_api/labels.rb +12 -0
- data/lib/testdroid_api/projects.rb +14 -0
- data/lib/testdroid_api/properties.rb +13 -0
- data/lib/testdroid_api/runs.rb +24 -0
- data/lib/testdroid_api/services.rb +18 -0
- data/lib/testdroid_api/user.rb +13 -0
- data/sample/BitbarSampleApp.apk +0 -0
- data/sample/BitbarSampleAppTest.apk +0 -0
- data/sample/sample.rb +39 -0
- data/spec/client_spec.rb +10 -0
- data/spec/device_groups_spec.rb +41 -0
- data/spec/files_spec.rb +53 -0
- data/spec/fixtures/apk.apk +0 -0
- data/spec/fixtures/cassettes/device_groups_authorize.json +1 -0
- data/spec/fixtures/cassettes/device_groups_create.json +1 -0
- data/spec/fixtures/cassettes/device_groups_delete.json +1 -0
- data/spec/fixtures/cassettes/device_groups_get_all.json +1 -0
- data/spec/fixtures/cassettes/device_groups_get_one.json +1 -0
- data/spec/fixtures/cassettes/files_authorize.json +1 -0
- data/spec/fixtures/cassettes/files_delete.json +1 -0
- data/spec/fixtures/cassettes/files_get_all.json +1 -0
- data/spec/fixtures/cassettes/files_get_one.json +1 -0
- data/spec/fixtures/cassettes/files_upload.json +1 -0
- data/spec/fixtures/cassettes/files_upload_with_wait.json +1 -0
- data/spec/fixtures/cassettes/label_groups_authorize.json +1 -0
- data/spec/fixtures/cassettes/label_groups_create.json +1 -0
- data/spec/fixtures/cassettes/label_groups_delete.json +1 -0
- data/spec/fixtures/cassettes/label_groups_get_all.json +1 -0
- data/spec/fixtures/cassettes/label_groups_get_labels.json +1 -0
- data/spec/fixtures/cassettes/label_groups_get_one.json +1 -0
- data/spec/fixtures/cassettes/projects_authorize.json +1 -0
- data/spec/fixtures/cassettes/projects_create.json +1 -0
- data/spec/fixtures/cassettes/projects_delete.json +1 -0
- data/spec/fixtures/cassettes/projects_get_all.json +1 -0
- data/spec/fixtures/cassettes/projects_get_one.json +1 -0
- data/spec/fixtures/cassettes/runs_abort_run.json +1 -0
- data/spec/fixtures/cassettes/runs_authorize.json +1 -0
- data/spec/fixtures/cassettes/runs_get_project_runs.json +1 -0
- data/spec/fixtures/cassettes/runs_start_run.json +1 -0
- data/spec/fixtures/data.txt +1 -0
- data/spec/fixtures/data2.txt +1 -0
- data/spec/label_groups_spec.rb +47 -0
- data/spec/projects_spec.rb +41 -0
- data/spec/runs_spec.rb +41 -0
- data/spec/spec_helper.rb +33 -0
- data/testdroid-api-client.gemspec +38 -0
- metadata +306 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5e04c5ed0c71cc364ab658da181bdc8d07dc3066a38f972cfea5fdbc2407fa84
|
4
|
+
data.tar.gz: 0d2ed3f5dba8f8e02c7ced22b2e34689a0f589fc94f14a881720cbb7586ac2fe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0dfbb1ec284c74aba8c3aa69a9feedd754f6db06748c6c1460a6800019ad47c3de566ad2a2bc99bce3fde41385131daf9cda005bdc2a738dcdf3435fca10c321
|
7
|
+
data.tar.gz: 74e67c40926303b6c24d3e0c1463e9e9fb2ce20351b30fef1ae50f1f5e52b2c9cdd07a47ae6b66a17001bc110ae6b51a53e7604728d11e8cb691b9c70dc98b1e
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
coverage
|
6
|
+
InstalledFiles
|
7
|
+
lib/bundler/man
|
8
|
+
pkg
|
9
|
+
rdoc
|
10
|
+
spec/reports
|
11
|
+
test/tmp
|
12
|
+
test/version_tmp
|
13
|
+
tmp
|
14
|
+
|
15
|
+
sample/results
|
16
|
+
|
17
|
+
# YARD artifacts
|
18
|
+
.yardoc
|
19
|
+
_yardoc
|
20
|
+
doc/
|
21
|
+
.DS_Store
|
22
|
+
|
23
|
+
# IDE
|
24
|
+
.idea
|
data/.travis.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
before_install:
|
2
|
+
- yes | gem update --system --force
|
3
|
+
- gem install bundler
|
4
|
+
deploy:
|
5
|
+
provider: rubygems
|
6
|
+
api_key:
|
7
|
+
secure: ZFKOZzwgB1s4/vD9BDb7lFWCO7xXP3ikG2DBZSdASii5iHM46X9ox2wt8h2XZd9RFKe9pyenJP9RsXmRVGanFgZ0wGu+oveWfA7oIKp6Eb6pNOBPs8MG0ZifAGUc7Ih1JUMuvNuOPRJ+QGc5FwPsu0EoxZn3gQCZNqdMNBRe17o=
|
8
|
+
on:
|
9
|
+
tags: true
|
10
|
+
gem: testdroid-api-client
|
11
|
+
script: bundle exec rspec
|
data/.whitesource
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"scanSettings": {
|
3
|
+
"configMode": "AUTO",
|
4
|
+
"configExternalURL": "",
|
5
|
+
"projectToken": "",
|
6
|
+
"baseBranches": []
|
7
|
+
},
|
8
|
+
"checkRunSettings": {
|
9
|
+
"vulnerableCheckRunConclusionLevel": "failure",
|
10
|
+
"displayMode": "diff"
|
11
|
+
},
|
12
|
+
"issueSettings": {
|
13
|
+
"minSeverityLevel": "LOW"
|
14
|
+
}
|
15
|
+
}
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
testdroid-api-client-updated (0.5.1)
|
5
|
+
deep_merge
|
6
|
+
faraday
|
7
|
+
oauth2
|
8
|
+
rest-client
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
addressable (2.7.0)
|
14
|
+
public_suffix (>= 2.0.2, < 5.0)
|
15
|
+
bump (0.10.0)
|
16
|
+
connection_pool (2.2.5)
|
17
|
+
crack (0.4.5)
|
18
|
+
rexml
|
19
|
+
deep_merge (1.2.1)
|
20
|
+
diff-lcs (1.4.4)
|
21
|
+
domain_name (0.5.20190701)
|
22
|
+
unf (>= 0.0.5, < 1.0.0)
|
23
|
+
excon (0.80.1)
|
24
|
+
faraday (1.4.0)
|
25
|
+
faraday-excon (~> 1.0)
|
26
|
+
faraday-net_http (~> 1.0)
|
27
|
+
faraday-net_http_persistent (~> 1.0)
|
28
|
+
multipart-post (>= 1.2, < 3)
|
29
|
+
ruby2_keywords (>= 0.0.4)
|
30
|
+
faraday-excon (1.0.0)
|
31
|
+
excon (>= 0.27.4)
|
32
|
+
faraday-net_http (1.0.1)
|
33
|
+
faraday-net_http_persistent (1.0.3)
|
34
|
+
net-http-persistent (>= 3.1)
|
35
|
+
hashdiff (1.0.1)
|
36
|
+
http-accept (1.7.0)
|
37
|
+
http-cookie (1.0.3)
|
38
|
+
domain_name (~> 0.5)
|
39
|
+
jwt (2.2.2)
|
40
|
+
mime-types (3.3.1)
|
41
|
+
mime-types-data (~> 3.2015)
|
42
|
+
mime-types-data (3.2021.0225)
|
43
|
+
multi_json (1.15.0)
|
44
|
+
multi_xml (0.6.0)
|
45
|
+
multipart-post (2.1.1)
|
46
|
+
net-http-persistent (4.0.1)
|
47
|
+
connection_pool (~> 2.2)
|
48
|
+
netrc (0.11.0)
|
49
|
+
oauth2 (1.4.7)
|
50
|
+
faraday (>= 0.8, < 2.0)
|
51
|
+
jwt (>= 1.0, < 3.0)
|
52
|
+
multi_json (~> 1.3)
|
53
|
+
multi_xml (~> 0.5)
|
54
|
+
rack (>= 1.2, < 3)
|
55
|
+
public_suffix (4.0.6)
|
56
|
+
rack (2.2.3)
|
57
|
+
rake (13.0.3)
|
58
|
+
rest-client (2.1.0)
|
59
|
+
http-accept (>= 1.7.0, < 2.0)
|
60
|
+
http-cookie (>= 1.0.2, < 2.0)
|
61
|
+
mime-types (>= 1.16, < 4.0)
|
62
|
+
netrc (~> 0.8)
|
63
|
+
rexml (3.2.5)
|
64
|
+
rspec (3.10.0)
|
65
|
+
rspec-core (~> 3.10.0)
|
66
|
+
rspec-expectations (~> 3.10.0)
|
67
|
+
rspec-mocks (~> 3.10.0)
|
68
|
+
rspec-collection_matchers (1.2.0)
|
69
|
+
rspec-expectations (>= 2.99.0.beta1)
|
70
|
+
rspec-core (3.10.1)
|
71
|
+
rspec-support (~> 3.10.0)
|
72
|
+
rspec-expectations (3.10.1)
|
73
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
+
rspec-support (~> 3.10.0)
|
75
|
+
rspec-mocks (3.10.2)
|
76
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
77
|
+
rspec-support (~> 3.10.0)
|
78
|
+
rspec-support (3.10.2)
|
79
|
+
ruby2_keywords (0.0.4)
|
80
|
+
unf (0.1.4)
|
81
|
+
unf_ext
|
82
|
+
unf_ext (0.0.7.7)
|
83
|
+
vcr (6.0.0)
|
84
|
+
webmock (3.12.2)
|
85
|
+
addressable (>= 2.3.6)
|
86
|
+
crack (>= 0.3.2)
|
87
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
88
|
+
yard (0.9.26)
|
89
|
+
|
90
|
+
PLATFORMS
|
91
|
+
ruby
|
92
|
+
|
93
|
+
DEPENDENCIES
|
94
|
+
bump
|
95
|
+
rake
|
96
|
+
rspec
|
97
|
+
rspec-collection_matchers
|
98
|
+
testdroid-api-client-updated!
|
99
|
+
vcr
|
100
|
+
webmock
|
101
|
+
yard
|
102
|
+
|
103
|
+
BUNDLED WITH
|
104
|
+
2.2.16
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Sakari Rautiainen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/testdroid-api-client.svg)](https://badge.fury.io/rb/testdroid-api-client)
|
2
|
+
[![Build Status](https://travis-ci.org/bitbar/testdroid-api-client-ruby.svg?branch=master)](https://travis-ci.org/bitbar/testdroid-api-client-ruby)
|
3
|
+
|
4
|
+
|
5
|
+
Testdroid API Client for Ruby
|
6
|
+
=============================
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
# Gemfile
|
12
|
+
gem "testdroid-api-client"
|
13
|
+
```
|
14
|
+
|
15
|
+
```bash
|
16
|
+
> bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
## Sample client usage - Authenticate
|
20
|
+
```ruby
|
21
|
+
require 'testdroid-api-client'
|
22
|
+
|
23
|
+
client = TestdroidAPI::Client.new('admin@localhost', 'admin')
|
24
|
+
```
|
25
|
+
|
26
|
+
## Sample usage - get projects
|
27
|
+
```ruby
|
28
|
+
@user = client.authorize
|
29
|
+
projects = @user.projects.list
|
30
|
+
```
|
31
|
+
|
32
|
+
## Get project by id
|
33
|
+
```ruby
|
34
|
+
project_id = 123
|
35
|
+
project123 = @user.projects.get(project_id)
|
36
|
+
#output project name
|
37
|
+
p "Project name #{project123.name}"
|
38
|
+
```
|
39
|
+
|
40
|
+
## Get project by name
|
41
|
+
```ruby
|
42
|
+
project = @user.projects.list({:filter => "s_name_eq_MyProject"})[0]
|
43
|
+
```
|
44
|
+
|
45
|
+
## Get available frameworks
|
46
|
+
```ruby
|
47
|
+
frameworks = @user.available_frameworks.list
|
48
|
+
```
|
49
|
+
|
50
|
+
## Find specific framework
|
51
|
+
```ruby
|
52
|
+
framework = @user.available_frameworks.list({:filter => "s_osType_eq_ANDROID;s_name_like_%Instrumentation"})[0]
|
53
|
+
```
|
54
|
+
|
55
|
+
## Upload files
|
56
|
+
```ruby
|
57
|
+
file_app = @user.files.upload(File.join(File.dirname(__FILE__), "BitbarSampleApp.apk"))
|
58
|
+
file_test = @user.files.upload(File.join(File.dirname(__FILE__), "BitbarSampleAppTest.apk"))
|
59
|
+
```
|
60
|
+
|
61
|
+
## Start test run
|
62
|
+
```ruby
|
63
|
+
test_run = @user.runs.create("{\"osType\": \"ANDROID\", \"projectId\": #{project.id}, \"frameworkId\":#{framework_id},
|
64
|
+
\"deviceIds\": #{id_list}, \"files\": [{\"id\": #{file_app.id}, \"action\": \"INSTALL\" },
|
65
|
+
{\"id\": #{file_test.id}, \"action\": \"RUN_TEST\" }]}")
|
66
|
+
|
67
|
+
#See full list of params: https://docs.bitbar.com/testing/api/tests/index.html#details-about-the-configuration-fields
|
68
|
+
```
|
69
|
+
|
70
|
+
## Download all files from test run
|
71
|
+
```ruby
|
72
|
+
test_run.device_sessions.list({:limit => 0}).each { |ds| ds.download_all_files("YOUR_PATH") }
|
73
|
+
```
|
74
|
+
|
75
|
+
## Get all input files
|
76
|
+
```ruby
|
77
|
+
files = @user.files
|
78
|
+
files.list({:limit => 40,:filter => "s_direction_eq_INPUT"}).each {
|
79
|
+
|f| puts "File id: #{f.id} name: #{f.name}" }
|
80
|
+
```
|
81
|
+
|
82
|
+
See https://cloud.bitbar.com/cloud/swagger-ui.html for more details about API V2
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require 'json'
|
3
|
+
require 'logger'
|
4
|
+
require 'rest-client'
|
5
|
+
require 'deep_merge'
|
6
|
+
require 'oauth2'
|
7
|
+
require 'timeout'
|
8
|
+
require 'set'
|
9
|
+
|
10
|
+
require 'testdroid_api/client'
|
11
|
+
require 'testdroid_api/apikey_client'
|
12
|
+
|
13
|
+
require 'testdroid_api/cloud_resource'
|
14
|
+
require 'testdroid_api/cloud_list_resource'
|
15
|
+
|
16
|
+
require 'testdroid_api/user'
|
17
|
+
require 'testdroid_api/frameworks'
|
18
|
+
require 'testdroid_api/projects'
|
19
|
+
require 'testdroid_api/runs'
|
20
|
+
require 'testdroid_api/devices'
|
21
|
+
require 'testdroid_api/device_groups'
|
22
|
+
require 'testdroid_api/device_sessions'
|
23
|
+
require 'testdroid_api/device_session_connections'
|
24
|
+
require 'testdroid_api/labels'
|
25
|
+
require 'testdroid_api/label_groups'
|
26
|
+
require 'testdroid_api/files'
|
27
|
+
require 'testdroid_api/properties'
|
28
|
+
require 'testdroid_api/services'
|
29
|
+
|
30
|
+
require 'testdroid_api/admin'
|
31
|
+
require 'testdroid_api/admin_devices'
|
32
|
+
require 'testdroid_api/admin_device_models'
|
33
|
+
require 'testdroid_api/admin_device_statuses'
|
34
|
+
require 'testdroid_api/admin_device_problems'
|
35
|
+
|
36
|
+
require 'testdroid-api-filter-builder'
|
@@ -0,0 +1,145 @@
|
|
1
|
+
module TestdroidAPI
|
2
|
+
class FilterBuilder
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
@filters = []
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
def check_type(subject)
|
10
|
+
if !!subject == subject # check if it's boolean
|
11
|
+
return 'b'
|
12
|
+
elsif (/^[0-9]{13}$/ =~ subject) != nil # check if it's timestamp
|
13
|
+
return 'd'
|
14
|
+
elsif (/^[0-9]+(?:\.[0-9]+)?$/ =~ subject) != nil # check if it's number
|
15
|
+
return 'n'
|
16
|
+
else
|
17
|
+
return 's'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def add(name, value, operand, type, check_nil=false)
|
22
|
+
unless value.is_a? Array
|
23
|
+
value = [value]
|
24
|
+
end
|
25
|
+
|
26
|
+
if value.length == 0
|
27
|
+
return self
|
28
|
+
end
|
29
|
+
|
30
|
+
# auto-convert
|
31
|
+
value.each_with_index do |val, index|
|
32
|
+
if val.is_a? Time
|
33
|
+
value[index] = val.to_i.to_s
|
34
|
+
elsif val.is_a? Fixnum
|
35
|
+
value[index] = val.to_s
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# auto-check type
|
40
|
+
if type.nil?
|
41
|
+
value.each do |val|
|
42
|
+
next if val.nil?
|
43
|
+
type = check_type(val)
|
44
|
+
break
|
45
|
+
end
|
46
|
+
|
47
|
+
if operand == 'in'
|
48
|
+
type = 'l'+type
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# check nil existence
|
53
|
+
if check_nil
|
54
|
+
is_nil = false
|
55
|
+
value.each do |val|
|
56
|
+
next unless val.nil?
|
57
|
+
is_nil = true
|
58
|
+
end
|
59
|
+
|
60
|
+
if is_nil
|
61
|
+
value = value.select { |item| !item.nil? }
|
62
|
+
operand += 'ornull'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# add filter
|
67
|
+
@filters.push(FilterItem.new(name, value, operand, type))
|
68
|
+
end
|
69
|
+
|
70
|
+
public
|
71
|
+
def gt(name, value)
|
72
|
+
add(name, value, 'gt', 'n')
|
73
|
+
end
|
74
|
+
|
75
|
+
def lt(name, value)
|
76
|
+
add(name, value, 'lt', 'n')
|
77
|
+
end
|
78
|
+
|
79
|
+
def after(name, value)
|
80
|
+
add(name, value, 'after', 'd', true)
|
81
|
+
end
|
82
|
+
|
83
|
+
def before(name, value)
|
84
|
+
add(name, value, 'before', 'd', true)
|
85
|
+
end
|
86
|
+
|
87
|
+
def on(name, value)
|
88
|
+
add(name, value, 'on', 'd')
|
89
|
+
end
|
90
|
+
|
91
|
+
def eq(name, value)
|
92
|
+
add(name, value, 'eq', nil)
|
93
|
+
end
|
94
|
+
|
95
|
+
def contains(name, value)
|
96
|
+
add(name, value, 'contains', 's')
|
97
|
+
end
|
98
|
+
|
99
|
+
def like(name, value)
|
100
|
+
nil # TODO (waiting for BE support)
|
101
|
+
end
|
102
|
+
|
103
|
+
def empty(name, value)
|
104
|
+
nil # TODO (waiting for BE support)
|
105
|
+
end
|
106
|
+
|
107
|
+
def isnull(name, operand)
|
108
|
+
add(name, nil, 'isnull', operand)
|
109
|
+
end
|
110
|
+
|
111
|
+
def in(name, value)
|
112
|
+
add(name, value, 'in', nil, true)
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
def to_s
|
117
|
+
parts = []
|
118
|
+
@filters.each do |filter|
|
119
|
+
val = ''
|
120
|
+
if filter.value.length > 1 or not filter.value.nil?
|
121
|
+
val = '_' + filter.values
|
122
|
+
end
|
123
|
+
parts.push( filter.to_s + val )
|
124
|
+
end
|
125
|
+
parts.join(';')
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
class FilterItem
|
131
|
+
attr_accessor :name, :value, :operand, :type
|
132
|
+
|
133
|
+
def initialize(name, value, operand, type)
|
134
|
+
@name, @value, @operand, @type = name, value, operand, type
|
135
|
+
end
|
136
|
+
|
137
|
+
def values
|
138
|
+
@value.join('|')
|
139
|
+
end
|
140
|
+
|
141
|
+
def to_s
|
142
|
+
"#{@type}_#{@name}_#{@operand}"
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|