qihu360 0.3.12 → 0.3.13

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
  SHA1:
3
- metadata.gz: 75934d4a842a4445106351a4edc180730f4f7a41
4
- data.tar.gz: 0de587d05e405d23a6046d67dbfbe443f4a7783d
3
+ metadata.gz: 353747a5058845779716e79a0b433d655d8bf1cc
4
+ data.tar.gz: 1c31e5245c86462a1f151c22de9606d37949ef47
5
5
  SHA512:
6
- metadata.gz: 3b395d6b45abc7a5b133c0ffd3a340f17281f92c22218b16f01825610d4f7b7c04c3c2acd0e88ebc264e5611881a6518890b584b39db69d76ab97f871c99f3b8
7
- data.tar.gz: 2c0355500aee76b999069411976d2095a663349d1fcfc790f81a3a4069e4540ba4612c16d6b710f4b8f55b7f82950f77af149e6b37e1e4516afe49af782d30a9
6
+ metadata.gz: 5f63e1f74749787f18a94e66f391a21e876042350a0b46ef3d57f1efb722882f1fb74448c332671092e28b9f6d548b5b0174136ae715835d538e1a2c1134c6a4
7
+ data.tar.gz: 133bbc01459a9e07de4e11cd6cd9761733abbe4b7592c1c7ae598777443d3b3347a8bb29433c7625dc0f0cac5223cbf7731fbe74c4ca10a12627482ae77c4d3f
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
+ .rvmrc
6
7
  Gemfile.lock
7
8
  InstalledFiles
8
9
  _yardoc
@@ -7,21 +7,30 @@ module Qihu
7
7
  end
8
8
 
9
9
  def method_missing(name, *args, &block)
10
+ require 'pp'
11
+
10
12
  if name.match(/_/)
11
13
  name = name.to_s.split('_').each_with_index.map{|k, i| (i > 0) ? k.capitalize : k}.join("")
12
14
  end
13
15
 
14
16
  params = {
15
17
  :format => 'json'
16
- }.merge(args[0])
18
+ }
19
+ params = params.merge(args[0]) if args[0].is_a?(Hash)
17
20
 
18
21
  begin
19
- method = name.match(/^get/) ? :get : :post
20
- uri_path = uri_path(name)
22
+ allowed_methods = [:get, :post, :put, :delete]
23
+ if params.include?(:method)
24
+ mehtod = params.delete(:method).downcase.to_sym
25
+ method = :get unless allowed_methods.include?method
26
+ else
27
+ method = name.match(/^get/) ? :get : :post
28
+ end
21
29
 
30
+ uri_path = uri_path(name)
22
31
  @client.auth.token.request(method, uri_path, :headers => client_headers, :params => params)
23
- rescue OAuth2::Error
24
- raise "Invaild API: #{@client.site}/#{uri_path}"
32
+ rescue OAuth2::Error => e
33
+ raise "Invaild API: '#{@client.site}/#{uri_path}' with message:\n#{e.message}"
25
34
  end
26
35
  end
27
36
 
@@ -1,3 +1,3 @@
1
1
  module Qihu
2
- VERSION = "0.3.12"
2
+ VERSION = "0.3.13"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qihu360
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - icyleaf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-22 00:00:00.000000000 Z
11
+ date: 2013-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,7 +89,6 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - .gitignore
91
91
  - .rspec
92
- - .rvmrc
93
92
  - Gemfile
94
93
  - LICENSE.txt
95
94
  - README.md
@@ -131,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
130
  version: '0'
132
131
  requirements: []
133
132
  rubyforge_project:
134
- rubygems_version: 2.0.7
133
+ rubygems_version: 2.0.6
135
134
  signing_key:
136
135
  specification_version: 4
137
136
  summary: Qihu 360.cn OAuth2 & Dianjing API wrapper
data/.rvmrc DELETED
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
- # Only full ruby name is supported here, for short names use:
8
- # echo "rvm use 2.0.0" > .rvmrc
9
- environment_id="ruby-2.0.0-p247@test"
10
-
11
- # Uncomment the following lines if you want to verify rvm version per project
12
- # rvmrc_rvm_version="1.22.1 (master)" # 1.10.1 seems like a safe start
13
- # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | __rvm_awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
- # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
- # return 1
16
- # }
17
-
18
- # First we attempt to load the desired environment directly from the environment
19
- # file. This is very fast and efficient compared to running through the entire
20
- # CLI and selector. If you want feedback on which environment was used then
21
- # insert the word 'use' after --create as this triggers verbose mode.
22
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
- then
25
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
- for __hook in "${rvm_path:-$HOME/.rvm}/hooks/after_use"*
27
- do
28
- if [[ -f "${__hook}" && -x "${__hook}" && -s "${__hook}" ]]
29
- then \. "${__hook}" || true
30
- fi
31
- done
32
- unset __hook
33
- if (( ${rvm_use_flag:=1} >= 2 )) # display only when forced
34
- then
35
- if [[ $- == *i* ]] # check for interactive shells
36
- then printf "%b" "Using: \E[32m$GEM_HOME\E[0m
37
- " # show the user the ruby and gemset they are using in green
38
- else printf "%b" "Using: $GEM_HOME
39
- " # don't use colors in non-interactive shells
40
- fi
41
- fi
42
- else
43
- # If the environment file has not yet been created, use the RVM CLI to select.
44
- rvm --create "$environment_id" || {
45
- echo "Failed to create RVM environment '${environment_id}'."
46
- return 1
47
- }
48
- fi
49
-
50
- # If you use bundler, this might be useful to you:
51
- # if [[ -s Gemfile ]] && {
52
- # ! builtin command -v bundle >/dev/null ||
53
- # builtin command -v bundle | GREP_OPTIONS="" \grep $rvm_path/bin/bundle >/dev/null
54
- # }
55
- # then
56
- # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
57
- # gem install bundler
58
- # fi
59
- # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
60
- # then
61
- # bundle install | GREP_OPTIONS="" \grep -vE '^Using|Your bundle is complete'
62
- # fi