zooppa_api_v3 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c16ab8d2b0b3108b136755e4b7f7afbebb5b0726
4
- data.tar.gz: c80d2bf0ba71f0be6fe70f883518b1510286d806
3
+ metadata.gz: 7cacc732b8632ba455ff73515dab8d1a34a83d86
4
+ data.tar.gz: 71e7bfe54f85d0390b8b1c4eb848d3c1824dcf2f
5
5
  SHA512:
6
- metadata.gz: fab49ec6581e909d96a016ae8f9cebbe93dc2696629c87a9231c3a028ef7ba77500121079d352144cdfae4a2f73297266fed7e57672d1bafb4eb59ad9619a8e6
7
- data.tar.gz: 3480179374c65c66ff121da583edb7ee4d7aed9d1144d1426a352189458ced67943cc145f9c08031a8f82a57c750ff4a72923bae671fbc271efdf65f680b7214
6
+ metadata.gz: 46073efec7e7482ab5be40900c507eee0ce188b4c2ff1082b69fa9f9d6ae0a0c8221f73c3ceb0a08aee18e20c004251eac4060bf4763ea38e62ba921c447c482
7
+ data.tar.gz: 7d1b966c892159f778503461694d4773ad869180d1aecd3834586bf26acc15c49dc23fde53b9f0afc22565ba1e2db879b55f402c478d6332f11bddc04e1c6645
data/README.md CHANGED
@@ -84,13 +84,21 @@ Get 100 contests with offset 100
84
84
 
85
85
  ###Filtering
86
86
 
87
- `ZOOPPA_API.ads.where('contest_id,=,1').execute('token')`
87
+ `ZOOPPA_API.ads.where('contest_id is 1').execute('token')`
88
88
 
89
89
  Get ads which contest_id attributes equals 1
90
90
 
91
- `ZOOPPA_API.ads.where('contest_id,=,1', 'resource_type,=,video').execute('token')`
91
+ `ZOOPPA_API.awards.where('custom:method_without_params').execute(token)`
92
92
 
93
- Get ads which contest_id attributes equals 1 and resource_type equals 'video'
93
+ Call a custom method called `method_without_params`
94
+
95
+ `ZOOPPA_API.awards.where('custom:method_with_one_param:param1').execute(token)`
96
+
97
+ Call a the custom method `method_with_one_param` with the parameter `param1`
98
+
99
+ `ZOOPPA_API.awards.where('custom:method_with_two_params:param1/param2').execute(token)`
100
+
101
+ Call the custom method `method_with_two_params` with parameters: `param1` and `param2`
94
102
 
95
103
  ###Sorting
96
104
 
data/lib/zooppa_api_v3.rb CHANGED
@@ -28,8 +28,6 @@ class ZooppaApiV3
28
28
  end
29
29
 
30
30
  def method_missing(method,*args,&block)
31
- puts "Params #{@params}"
32
- puts "Filter params: #{@filter_params }"
33
31
  eigenclass = class << self; self; end
34
32
  eigenclass.class_eval do
35
33
  define_method(method) do
@@ -57,7 +55,11 @@ class ZooppaApiV3
57
55
  @filter_params = ''
58
56
  args.each_with_index do |filter, index|
59
57
  @filter_params += '&' unless @filter_params == ''
60
- @filter_params += "filters[filter_#{index}]=#{filter}"
58
+ if filter.split(':')[0] == 'custom'
59
+ @filter_params += URI.encode("custom_filters[#{filter.split(':')[1]}]=#{filter.split(':')[2]}")
60
+ else
61
+ @filter_params += URI.encode("filters[]=#{filter}")
62
+ end
61
63
  end
62
64
  self
63
65
  end
@@ -110,8 +112,6 @@ class ZooppaApiV3
110
112
 
111
113
  # Builds the URL (adds an id of provided)
112
114
  def build_url
113
- puts "Complete params: #{complete_parameters(query_params, pagination_params)}"
114
- puts "Complete params: #{complete_parameters(query_params, pagination_params)}"
115
115
  url = @api_host + 'api/' + @version + '/' + @resource
116
116
  url += '/' + @id if @id
117
117
  url += '.json'
@@ -136,7 +136,6 @@ class ZooppaApiV3
136
136
  end
137
137
 
138
138
  def query_params
139
- puts "query params: execute"
140
139
  query_params = ''
141
140
  if @filter_params
142
141
  query_params += @filter_params
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "zooppa_api_v3"
8
- spec.version = '0.0.7'
8
+ spec.version = '0.0.8'
9
9
  spec.authors = ["Ulrich Soeffing"]
10
10
  spec.email = ["ulrich_soeffing@gmx.de"]
11
11
  spec.description = "Wrapper for the Zooppa api v3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zooppa_api_v3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ulrich Soeffing
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-26 00:00:00.000000000 Z
11
+ date: 2015-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler