evrythng 0.0.3 → 0.0.5

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/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ *.gem
2
+ *.rbc
3
+ .DS_Store
4
+ .bundle
5
+ .rvmrc
6
+ .yardoc
7
+ Gemfile.lock
8
+ coverage/*
9
+ doc/*
10
+ log/*
11
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ platforms :jruby do
4
+ gem 'jruby-openssl', '~> 0.7'
5
+ end
6
+
7
+ gemspec
data/evrythng.gemspec CHANGED
@@ -16,13 +16,18 @@ Gem::Specification.new do |s|
16
16
  s.platform = Gem::Platform::RUBY
17
17
  s.require_path = 'lib'
18
18
 
19
- s.add_development_dependency('yard', '~> 0.6')
19
+ s.add_development_dependency 'maruku', '~> 0.6'
20
+ s.add_development_dependency 'nokogiri', '~> 1.4'
21
+ s.add_development_dependency 'rake', '~> 0.9'
22
+ s.add_development_dependency 'rspec', '~> 2.6'
23
+ s.add_development_dependency 'simplecov', '~> 0.4'
24
+ s.add_development_dependency 'webmock', '~> 1.7'
25
+ s.add_development_dependency 'yard', '~> 0.7'
26
+ s.add_development_dependency 'ZenTest', '~> 4.5'
20
27
 
21
- s.add_runtime_dependency 'hashie', '~> 1.0.0'
22
- s.add_runtime_dependency 'faraday', '~> 0.6.1'
23
- s.add_runtime_dependency 'faraday_middleware', '~> 0.6.3'
28
+ s.add_runtime_dependency 'hashie', '~> 1.1.0'
29
+ s.add_runtime_dependency 'faraday', '~> 0.7.4'
30
+ s.add_runtime_dependency 'faraday_middleware', '~> 0.7.0'
24
31
  s.add_runtime_dependency 'multi_json', '~> 1.0.0'
25
- s.add_runtime_dependency 'multi_xml', '~> 0.2.0'
26
- s.add_runtime_dependency 'rash', '~> 0.3.0'
27
32
  s.add_runtime_dependency 'simple_oauth', '~> 0.1.5'
28
33
  end
data/lib/evrythng/api.rb CHANGED
@@ -1,10 +1,15 @@
1
+ require 'evrythng/authentication'
2
+ require 'evrythng/configuration'
1
3
  require 'evrythng/connection'
2
4
  require 'evrythng/request'
3
- require 'evrythng/authentication'
4
5
 
5
6
  module Evrythng
6
7
  # @private
7
8
  class API
9
+ include Connection
10
+ include Request
11
+ include Authentication
12
+
8
13
  # @private
9
14
  attr_accessor *Configuration::VALID_OPTIONS_KEYS
10
15
 
@@ -15,9 +20,5 @@ module Evrythng
15
20
  send("#{key}=", options[key])
16
21
  end
17
22
  end
18
-
19
- include Connection
20
- include Request
21
- include Authentication
22
23
  end
23
24
  end
@@ -8,7 +8,7 @@ module Evrythng
8
8
  # @authenticated true
9
9
  # @rate_limited true
10
10
  # @param options [Hash] A customizable set of options.
11
- # @return [Hashie::Rash] The requested list of collections.
11
+ # @return [Hashie::Mash] The requested list of collections.
12
12
  # @see http://dev.evrythng.net/doc/get/collections
13
13
  # @example Return the list of collections
14
14
  # Evrythng.collections
@@ -25,7 +25,7 @@ module Evrythng
25
25
  # @param name [String] The name of collection.
26
26
  # @param description [String] The description of collection.
27
27
  # @param options [Hash] A customizable set of options.
28
- # @return [Hashie::Rash] The created collection.
28
+ # @return [Hashie::Mash] The created collection.
29
29
  # @see http://dev.evrythng.net/doc/post/collections
30
30
  # @example Create the authenticating user's collection
31
31
  # Evrythng.collection_create("This is a new collection!", "Here comes the description.")
@@ -8,7 +8,7 @@ module Evrythng
8
8
  # @authenticated true
9
9
  # @rate_limited true
10
10
  # @param options [Hash] A customizable set of options.
11
- # @return [Hashie::Rash] The requested list of thngs.
11
+ # @return [Hashie::Mash] The requested list of thngs.
12
12
  # @see http://developer.evrythng.net/thngs
13
13
  # @example Return the list of thngs
14
14
  # Evrythng.thngs
@@ -25,7 +25,7 @@ module Evrythng
25
25
  # @param identifier [String] The identifier of thng.
26
26
  # @param description [String] The description of thng.
27
27
  # @param options [Hash] A customizable set of options.
28
- # @return [Hashie::Rash] The created thng.
28
+ # @return [Hashie::Mash] The created thng.
29
29
  # @see http://developer.evrythng.net/thngs
30
30
  # @example Create the authenticating user's thng
31
31
  # Evrythng.thng_create("my.test.thng", "Here comes the description.")
@@ -21,11 +21,9 @@ module Evrythng
21
21
  :user_agent].freeze
22
22
 
23
23
  # An array of valid request/response formats
24
- #
25
- # @note Not all methods support the XML format.
26
24
  VALID_FORMATS = [
27
- :json,
28
- :xml].freeze
25
+ 'vnd.evrythng-v1+json'
26
+ ].freeze
29
27
 
30
28
  # The adapter that will be used to connect if none is set
31
29
  #
@@ -45,12 +43,10 @@ module Evrythng
45
43
  DEFAULT_PASSWORD = nil
46
44
 
47
45
  # The endpoint that will be used to connect if none is set
48
- DEFAULT_ENDPOINT = 'http://api.evrythng.net'.freeze
46
+ DEFAULT_ENDPOINT = 'http://evrythng.net'.freeze
49
47
 
50
48
  # The response format appended to the path and sent in the 'Accept' header if none is set
51
- #
52
- # @note JSON is preferred over XML because it is more concise and faster to parse.
53
- DEFAULT_FORMAT = :json
49
+ DEFAULT_FORMAT = 'vnd.evrythng-v1+json'.freeze
54
50
 
55
51
  # By default, don't set a user oauth token
56
52
  DEFAULT_OAUTH_TOKEN = nil
@@ -11,9 +11,12 @@ module Evrythng
11
11
  module Connection
12
12
  private
13
13
 
14
- def connection(raw=false)
14
+ def connection(format=format)
15
15
  options = {
16
- :headers => {'Accept' => "application/vnd.evrythng-v1+json", 'User-Agent' => user_agent},
16
+ :headers => {
17
+ :accept => "application/#{format}",
18
+ :user_agent => user_agent
19
+ },
17
20
  :proxy => proxy,
18
21
  :ssl => {:verify => false},
19
22
  :url => api_endpoint,
@@ -21,20 +24,14 @@ module Evrythng
21
24
 
22
25
  Faraday.new(options) do |builder|
23
26
  builder.use Faraday::Request::MultipartWithFile
24
- builder.use Faraday::Request::Multipart
27
+ # builder.use Faraday::Request::EvrythngOAuth, authentication if authenticated?
25
28
  builder.use Faraday::Request::BasicAuthentication, username, password
29
+ builder.use Faraday::Request::Multipart
26
30
  builder.use Faraday::Request::UrlEncoded
27
31
  builder.use Faraday::Request::Gateway, gateway if gateway
28
32
  builder.use Faraday::Response::RaiseHttp4xx
29
- builder.use Faraday::Response::Rashify unless raw
30
- unless raw
31
- case format.to_s.downcase
32
- when 'json'
33
- builder.use Faraday::Response::ParseJson
34
- when 'xml'
35
- builder.use Faraday::Response::ParseXml
36
- end
37
- end
33
+ builder.use Faraday::Response::Mashify
34
+ builder.use Faraday::Response::ParseJson
38
35
  builder.use Faraday::Response::RaiseHttp5xx
39
36
  builder.adapter(adapter)
40
37
  end
@@ -2,31 +2,31 @@ module Evrythng
2
2
  # Defines HTTP request methods
3
3
  module Request
4
4
  # Perform an HTTP GET request
5
- def get(path, options={}, raw=false)
6
- request(:get, path, options, raw)
5
+ def get(path, options={}, format=format)
6
+ request(:get, path, options, format)
7
7
  end
8
8
 
9
9
  # Perform an HTTP POST request
10
- def post(path, options={}, raw=false)
11
- request(:post, path, options, raw)
10
+ def post(path, options={}, format=format)
11
+ request(:post, path, options, format)
12
12
  end
13
13
 
14
14
  # Perform an HTTP PUT request
15
- def put(path, options={}, raw=false)
16
- request(:put, path, options, raw)
15
+ def put(path, options={}, format=format)
16
+ request(:put, path, options, format)
17
17
  end
18
18
 
19
19
  # Perform an HTTP DELETE request
20
- def delete(path, options={}, raw=false)
21
- request(:delete, path, options, raw)
20
+ def delete(path, options={}, format=format)
21
+ request(:delete, path, options, format)
22
22
  end
23
23
 
24
24
  private
25
25
 
26
26
  # Perform an HTTP request
27
- def request(method, path, options, raw=false)
28
- response = connection(raw).send(method) do |request|
29
- case method
27
+ def request(method, path, options, format)
28
+ response = connection(format).send(method) do |request|
29
+ case method.to_sym
30
30
  when :get, :delete
31
31
  request.url(path, options)
32
32
  when :post, :put
@@ -34,7 +34,7 @@ module Evrythng
34
34
  request.body = options unless options.empty?
35
35
  end
36
36
  end
37
- raw ? response : response.body
37
+ 'raw' == format.to_s.downcase ? response : response.body
38
38
  end
39
39
  end
40
40
  end
@@ -0,0 +1,173 @@
1
+ require 'cgi'
2
+
3
+ module Evrythng
4
+ # Wrapper for the Evrythng Search API
5
+ class Search < API
6
+ include Enumerable
7
+
8
+ # @private
9
+ attr_reader :query
10
+
11
+ # Creates a new search
12
+ #
13
+ # @example Initialize an Evrythng search
14
+ # search = Evrythng::Search.new
15
+ def initialize(*)
16
+ clear
17
+ super
18
+ end
19
+
20
+ # Clears all query filters and cached results
21
+ #
22
+ # @return [Evrythng::Search] self
23
+ # @example Clear a search for "evrythng"
24
+ # search = Evrythng::Search.new
25
+ # search.containing("bike").fetch
26
+ # search.clear
27
+ # search.fetch_next_page #=> 403 Forbidden: You must enter a query.
28
+ def clear
29
+ @cache = nil
30
+ @query = {}
31
+ @query[:q] = []
32
+ self
33
+ end
34
+
35
+ # @group Generic filters
36
+
37
+ # Search query
38
+ #
39
+ # @param query [String] The search query.
40
+ # @return [Evrythng::Search] self
41
+ # @example Return an array of thngs containing "bike"
42
+ # Evrythng::Search.new.containing("bike").fetch
43
+ def containing(query)
44
+ @query[:q] << query
45
+ self
46
+ end
47
+
48
+ # Negative search query
49
+ #
50
+ # @param query [String] The negative search query.
51
+ # @return [Evrythng::Search] self
52
+ # @example Return an array of thngs containing "bike" but not "mountain"
53
+ # Evrythng::Search.new.containing("bike").not_containing("mountain").fetch
54
+ def not_containing(query)
55
+ @query[:q] << "-#{query}"
56
+ self
57
+ end
58
+
59
+ # Only include thngs from users in a given radius of a given location
60
+ #
61
+ # @param lat [Float] A latitude.
62
+ # @param long [Float] A longitude.
63
+ # @param radius [String] A search radius, specified in either 'mi' (miles) or 'km' (kilometers).
64
+ # @return [Evrythng::Search] self
65
+ # @example Return an array of thngs within a 1-kilometer radius of Barcelona
66
+ # Evrythng::Search.new.containing("bike").geocode(41.38, 2.18, "1km").fetch
67
+ def geocode(lat, long, radius)
68
+ @query[:geocode] = [lat, long, radius].join(",")
69
+ self
70
+ end
71
+
72
+ # @group User filters
73
+
74
+ # Only include thngs owned by a given user, specified by screen_name
75
+ #
76
+ # @param screen_name [String] A Evrythng user name.
77
+ # @return [Evrythng::Search] self
78
+ # @example Return an array of thngs containing "bike" from "mike"
79
+ # Evrythng::Search.new.containing("bike").from("mike").fetch
80
+ def from(screen_name)
81
+ @query[:q] << "from:#{screen_name}"
82
+ self
83
+ end
84
+
85
+ # Exclude thngs from a given user, specified by screen_name
86
+ #
87
+ # @param screen_name [String] A Evrythng user name.
88
+ # @return [Evrythng::Search] self
89
+ # @example Return an array of thngs containing "bike" from everyone except "mike"
90
+ # Evrythng::Search.new.containing("bike").not_from("mike").fetch
91
+ def not_from(screen_name)
92
+ @query[:q] << "-from:#{screen_name}"
93
+ self
94
+ end
95
+
96
+ # @group Paging
97
+
98
+ # Specify the number of thngs to return per page
99
+ #
100
+ # @param number [Integer] The number of thngs to return per page, up to a max of 100.
101
+ # @return [Evrythng::Search] self
102
+ # @example Return an array of 100 thngs containing "bike"
103
+ # Evrythng::Search.new.containing("bike").per_page(100).fetch
104
+ def per_page(number=15)
105
+ @query[:per_page] = number
106
+ self
107
+ end
108
+
109
+ # Specify the page number to return, up to a maximum of roughly 500 results
110
+ #
111
+ # @param number [Integer] The page number (starting at 1) to return, up to a max of roughly 500 results (based on {Evrythng::Client::Search#per_page} * {Evrythng::Client::Search#page}).
112
+ # @return [Evrythng::Search] self
113
+ # @example Return the second page of thngs containing "bike"
114
+ # Evrythng::Search.new.containing("bike").page(2).fetch
115
+ def page(number)
116
+ @query[:page] = number
117
+ self
118
+ end
119
+
120
+ # Indicates if there are additional results to be fetched
121
+ #
122
+ # @return [Boolean]
123
+ # @example
124
+ # search = Evrythng::Search.new.containing("bike").fetch
125
+ # search.next_page? #=> true
126
+ def next_page?
127
+ fetch if @cache.nil?
128
+ !!@cache["next_page"]
129
+ end
130
+
131
+ # @group Fetching
132
+
133
+ # Fetch the next page of results of the query
134
+ #
135
+ # @return [Array] Thngs that match specified query.
136
+ # @example Return the first two pages of results
137
+ # search = Evrythng::Search.new.containing("bike").fetch
138
+ # search.fetch_next_page
139
+ def fetch_next_page
140
+ if next_page?
141
+ @cache = get("search", CGI.parse(@cache["next_page"][1..-1]), :json)
142
+ @cache.results
143
+ end
144
+ end
145
+
146
+ # Fetch the results of the query
147
+ #
148
+ # @param force [Boolean] Ignore the cache and hit the API again.
149
+ # @return [Array] Thngs that match specified query.
150
+ # @example Return an array of thngs containing "bike"
151
+ # search = Evrythng::Search.new.containing("bike").fetch
152
+ def fetch(force=false)
153
+ if @cache.nil? || force
154
+ options = query.dup
155
+ options[:q] = options[:q].join(" ")
156
+ @cache = get("search", options, :json)
157
+ end
158
+ @cache.results
159
+ end
160
+
161
+ # Calls block once for each element in self, passing that element as a parameter
162
+ #
163
+ # @yieldparam [Hashie::Mash] result Thngs that matches specified query.
164
+ # @return [Array] Thngs that match specified query.
165
+ # @example
166
+ # Evrythng::Search.new.containing('cafe del mar').each do |result|
167
+ # puts "#{result.identifier} by #{result.owner}"
168
+ # end
169
+ def each
170
+ fetch.each{|result| yield result}
171
+ end
172
+ end
173
+ end
@@ -1,4 +1,4 @@
1
1
  module Evrythng
2
2
  # The version of the gem
3
- VERSION = '0.0.3'.freeze unless defined?(::Evrythng::VERSION)
3
+ VERSION = '0.0.5'.freeze unless defined?(::Evrythng::VERSION)
4
4
  end
data/lib/evrythng.rb CHANGED
@@ -1,25 +1,27 @@
1
- require 'evrythng/error'
2
- require 'evrythng/configuration'
3
1
  require 'evrythng/api'
4
2
  require 'evrythng/client'
3
+ require 'evrythng/configuration'
4
+ require 'evrythng/error'
5
+ require 'evrythng/search'
5
6
 
6
7
  module Evrythng
7
8
  extend Configuration
9
+ class << self
10
+ # Alias for Evrythng::Client.new
11
+ #
12
+ # @return [Evrythng::Client]
13
+ def new(options={})
14
+ Evrythng::Client.new(options)
15
+ end
8
16
 
9
- # Alias for Evrythng::Client.new
10
- #
11
- # @return [Evrythng::Client]
12
- def self.new(options={})
13
- Evrythng::Client.new(options)
14
- end
15
-
16
- # Delegate to Evrythng::Client
17
- def self.method_missing(method, *args, &block)
18
- return super unless new.respond_to?(method)
19
- new.send(method, *args, &block)
20
- end
17
+ # Delegate to evrythng::Client
18
+ def method_missing(method, *args, &block)
19
+ return super unless new.respond_to?(method)
20
+ new.send(method, *args, &block)
21
+ end
21
22
 
22
- def self.respond_to?(method, include_private = false)
23
- new.respond_to?(method, include_private) || super(method, include_private)
23
+ def respond_to?(method, include_private = false)
24
+ new.respond_to?(method, include_private) || super(method, include_private)
25
+ end
24
26
  end
25
27
  end
@@ -20,10 +20,14 @@ module Faraday
20
20
 
21
21
  def mime_type(file)
22
22
  case file.path
23
- when /\.jpe?g/i then 'image/jpeg'
24
- when /\.gif$/i then 'image/gif'
25
- when /\.png$/i then 'image/png'
26
- else 'application/octet-stream'
23
+ when /\.jpe?g/i
24
+ 'image/jpeg'
25
+ when /\.gif$/i
26
+ 'image/gif'
27
+ when /\.png$/i
28
+ 'image/png'
29
+ else
30
+ 'application/octet-stream'
27
31
  end
28
32
  end
29
33
  end
@@ -11,7 +11,7 @@ module Faraday
11
11
  when 502
12
12
  raise Evrythng::BadGateway.new(error_message(env, "Evrythng is down or being upgraded."), env[:response_headers])
13
13
  when 503
14
- raise Evrythng::ServiceUnavailable.new(error_message(env, "(__-){ Evrythng is over capacity."), env[:response_headers])
14
+ raise Evrythng::ServiceUnavailable.new(error_message(env, "Evrythng is over capacity."), env[:response_headers])
15
15
  end
16
16
  end
17
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evrythng
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-18 00:00:00.000000000Z
12
+ date: 2011-08-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: yard
16
- requirement: &70139585247600 !ruby/object:Gem::Requirement
15
+ name: maruku
16
+ requirement: &70184618669300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,76 +21,131 @@ dependencies:
21
21
  version: '0.6'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70139585247600
24
+ version_requirements: *70184618669300
25
25
  - !ruby/object:Gem::Dependency
26
- name: hashie
27
- requirement: &70139585247000 !ruby/object:Gem::Requirement
26
+ name: nokogiri
27
+ requirement: &70184618668780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 1.0.0
33
- type: :runtime
32
+ version: '1.4'
33
+ type: :development
34
34
  prerelease: false
35
- version_requirements: *70139585247000
35
+ version_requirements: *70184618668780
36
36
  - !ruby/object:Gem::Dependency
37
- name: faraday
38
- requirement: &70139585246440 !ruby/object:Gem::Requirement
37
+ name: rake
38
+ requirement: &70184618668220 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 0.6.1
44
- type: :runtime
43
+ version: '0.9'
44
+ type: :development
45
45
  prerelease: false
46
- version_requirements: *70139585246440
46
+ version_requirements: *70184618668220
47
47
  - !ruby/object:Gem::Dependency
48
- name: faraday_middleware
49
- requirement: &70139585245920 !ruby/object:Gem::Requirement
48
+ name: rspec
49
+ requirement: &70184618667680 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.6'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70184618667680
58
+ - !ruby/object:Gem::Dependency
59
+ name: simplecov
60
+ requirement: &70184618667060 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '0.4'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70184618667060
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: &70184618666540 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '1.7'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70184618666540
80
+ - !ruby/object:Gem::Dependency
81
+ name: yard
82
+ requirement: &70184618665940 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: '0.7'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *70184618665940
91
+ - !ruby/object:Gem::Dependency
92
+ name: ZenTest
93
+ requirement: &70184618665460 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ~>
97
+ - !ruby/object:Gem::Version
98
+ version: '4.5'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *70184618665460
102
+ - !ruby/object:Gem::Dependency
103
+ name: hashie
104
+ requirement: &70184618665000 !ruby/object:Gem::Requirement
50
105
  none: false
51
106
  requirements:
52
107
  - - ~>
53
108
  - !ruby/object:Gem::Version
54
- version: 0.6.3
109
+ version: 1.1.0
55
110
  type: :runtime
56
111
  prerelease: false
57
- version_requirements: *70139585245920
112
+ version_requirements: *70184618665000
58
113
  - !ruby/object:Gem::Dependency
59
- name: multi_json
60
- requirement: &70139585245460 !ruby/object:Gem::Requirement
114
+ name: faraday
115
+ requirement: &70184618664480 !ruby/object:Gem::Requirement
61
116
  none: false
62
117
  requirements:
63
118
  - - ~>
64
119
  - !ruby/object:Gem::Version
65
- version: 1.0.0
120
+ version: 0.7.4
66
121
  type: :runtime
67
122
  prerelease: false
68
- version_requirements: *70139585245460
123
+ version_requirements: *70184618664480
69
124
  - !ruby/object:Gem::Dependency
70
- name: multi_xml
71
- requirement: &70139585244920 !ruby/object:Gem::Requirement
125
+ name: faraday_middleware
126
+ requirement: &70184618664000 !ruby/object:Gem::Requirement
72
127
  none: false
73
128
  requirements:
74
129
  - - ~>
75
130
  - !ruby/object:Gem::Version
76
- version: 0.2.0
131
+ version: 0.7.0
77
132
  type: :runtime
78
133
  prerelease: false
79
- version_requirements: *70139585244920
134
+ version_requirements: *70184618664000
80
135
  - !ruby/object:Gem::Dependency
81
- name: rash
82
- requirement: &70139585244420 !ruby/object:Gem::Requirement
136
+ name: multi_json
137
+ requirement: &70184618663520 !ruby/object:Gem::Requirement
83
138
  none: false
84
139
  requirements:
85
140
  - - ~>
86
141
  - !ruby/object:Gem::Version
87
- version: 0.3.0
142
+ version: 1.0.0
88
143
  type: :runtime
89
144
  prerelease: false
90
- version_requirements: *70139585244420
145
+ version_requirements: *70184618663520
91
146
  - !ruby/object:Gem::Dependency
92
147
  name: simple_oauth
93
- requirement: &70139585243900 !ruby/object:Gem::Requirement
148
+ requirement: &70184618662980 !ruby/object:Gem::Requirement
94
149
  none: false
95
150
  requirements:
96
151
  - - ~>
@@ -98,7 +153,7 @@ dependencies:
98
153
  version: 0.1.5
99
154
  type: :runtime
100
155
  prerelease: false
101
- version_requirements: *70139585243900
156
+ version_requirements: *70184618662980
102
157
  description: A Ruby wrapper for Evrythng API. Just proof of concept, do not consider
103
158
  this as a solid library.
104
159
  email: graf.otodrakula@gmail.com
@@ -106,6 +161,8 @@ executables: []
106
161
  extensions: []
107
162
  extra_rdoc_files: []
108
163
  files:
164
+ - .gitignore
165
+ - Gemfile
109
166
  - README.md
110
167
  - Rakefile
111
168
  - evrythng.gemspec
@@ -119,12 +176,12 @@ files:
119
176
  - lib/evrythng/connection.rb
120
177
  - lib/evrythng/error.rb
121
178
  - lib/evrythng/request.rb
179
+ - lib/evrythng/search.rb
122
180
  - lib/evrythng/version.rb
123
181
  - lib/faraday/request/basic_authentication.rb
124
182
  - lib/faraday/request/evrythng_oauth.rb
125
183
  - lib/faraday/request/gateway.rb
126
184
  - lib/faraday/request/multipart_with_file.rb
127
- - lib/faraday/request/oauth.rb
128
185
  - lib/faraday/response/raise_http_4xx.rb
129
186
  - lib/faraday/response/raise_http_5xx.rb
130
187
  homepage: http://github.com/bai/evrythng-ruby
@@ -147,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
204
  version: '0'
148
205
  requirements: []
149
206
  rubyforge_project:
150
- rubygems_version: 1.8.5
207
+ rubygems_version: 1.8.7
151
208
  signing_key:
152
209
  specification_version: 3
153
210
  summary: A Ruby wrapper for Evrythng API
@@ -1,24 +0,0 @@
1
- require 'faraday'
2
-
3
- module Faraday
4
- class Request::OAuth < Faraday::Middleware
5
- dependency 'simple_oauth'
6
-
7
- def call(env)
8
- params = env[:body] || {}
9
- signature_params = params
10
-
11
- params.map{ |k,v| signature_params = {} if v.respond_to?(:content_type) }
12
-
13
- header = SimpleOAuth::Header.new(env[:method], env[:url], signature_params, @options)
14
-
15
- env[:request_headers]['Authorization'] = header.to_s
16
-
17
- @app.call(env)
18
- end
19
-
20
- def initialize(app, options)
21
- @app, @options = app, options
22
- end
23
- end
24
- end