qwerly 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in qwerly.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,3 @@
1
+ module Qwerly
2
+ VERSION = "0.0.1"
3
+ end
data/lib/qwerly.rb ADDED
@@ -0,0 +1,53 @@
1
+ module Qwerly
2
+ BASE_URL = "http://api.qwerly.com/v1"
3
+
4
+ class QwerlyBase
5
+ attr_accessor :key
6
+
7
+ def initialize(key)
8
+ @key = key
9
+ end
10
+ end
11
+
12
+ class Profile < QwerlyBase
13
+ def facebook_by_id(facebook_id)
14
+ Qwerly.process_response "#{BASE_URL}/facebook/#{facebook_id}?api_key=#{@key}"
15
+ end
16
+
17
+ def facebook_by_username(username)
18
+ Qwerly.process_response "#{BASE_URL}/facebook/username/#{username}?api_key=#{key}"
19
+ end
20
+
21
+ def twitter(username)
22
+ Qwerly.process_response "#{BASE_URL}/twitter/#{username}?api_key=#{@key}"
23
+ end
24
+
25
+ def email(email)
26
+ Qwerly.process_response "#{BASE_URL}/email/#{email}?api_key=#{@key}"
27
+ end
28
+ end
29
+
30
+ class Services < QwerlyBase
31
+ def facebook_by_id(facebook_id)
32
+ Qwerly.process_response "#{BASE_URL}/facebook/#{facebook_id}/services?api_key=#{@key}"
33
+ end
34
+
35
+ def facebook_by_username(username)
36
+ Qwerly.process_response "#{BASE_URL}/facebook/username/#{username}/services?api_key=#{key}"
37
+ end
38
+
39
+ def twitter(username)
40
+ Qwerly.process_response "#{BASE_URL}/twitter/#{username}/services?api_key=#{@key}"
41
+ end
42
+
43
+ def email(email)
44
+ Qwerly.process_response "#{BASE_URL}/email/#{email}/services?api_key=#{@key}"
45
+ end
46
+ end
47
+
48
+ def self.process_response(url)
49
+ response = Net::HTTP.get_response(URI.parse(url))
50
+ JSON.parse(response.body)
51
+ end
52
+ end
53
+
data/qwerly.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "qwerly/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "qwerly"
7
+ s.version = Qwerly::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Andrei Misarca"]
10
+ s.email = ["andrei.misarca@gmail.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{Qwerly library for Ruby}
13
+ s.description = %q{Retrieves data using the Qwerly application}
14
+
15
+ s.rubyforge_project = "qwerly"
16
+
17
+ s.add_development_dependency ["json", "net/http"]
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ["lib"]
23
+ end
24
+
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: qwerly
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Andrei Misarca
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-07-31 00:00:00 +03:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name:
22
+ - json
23
+ - net/http
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ description: Retrieves data using the Qwerly application
36
+ email:
37
+ - andrei.misarca@gmail.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - Rakefile
48
+ - lib/qwerly.rb
49
+ - lib/qwerly/version.rb
50
+ - qwerly.gemspec
51
+ has_rdoc: true
52
+ homepage: ""
53
+ licenses: []
54
+
55
+ post_install_message:
56
+ rdoc_options: []
57
+
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ requirements: []
77
+
78
+ rubyforge_project: qwerly
79
+ rubygems_version: 1.3.7
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: Qwerly library for Ruby
83
+ test_files: []
84
+