hash-blue 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -1
- data/README.md +9 -3
- data/Rakefile +28 -1
- data/hash-blue.gemspec +5 -1
- data/lib/hash-blue.rb +2 -0
- data/lib/hash_blue/contact.rb +0 -2
- data/lib/hash_blue/version.rb +1 -1
- data/spec/account_spec.rb +1 -3
- data/spec/contact_spec.rb +1 -3
- data/spec/message_spec.rb +3 -6
- metadata +83 -43
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -27,6 +27,7 @@ You can either use the Rails Engine or create your own logic.
|
|
27
27
|
### Use the embedded Rails Engine
|
28
28
|
|
29
29
|
* Insert in your rails application Gemfile the dependency hash-blue
|
30
|
+
|
30
31
|
gem 'hash-blue'
|
31
32
|
|
32
33
|
* Two new endpoints are created (check running ''bundle install'' and ''rake routes''):
|
@@ -34,17 +35,22 @@ You can either use the Rails Engine or create your own logic.
|
|
34
35
|
\# this method redirects to hashblue web page to start the oAuth process
|
35
36
|
|
36
37
|
/hashblue/index
|
38
|
+
|
37
39
|
\# this method gets the Oauth response, asks for a valid access token and sends the data
|
38
40
|
|
39
41
|
/hashblue/code
|
40
42
|
|
41
43
|
* Configure in an application initializer your specific data (i.e. config/initializer/hashblue.rb)
|
42
44
|
|
43
|
-
Rails.application.config.hashblue.client_id =
|
44
|
-
|
45
|
+
Rails.application.config.hashblue.client_id = "app_client_id"
|
46
|
+
|
47
|
+
Rails.application.config.hashblue.client_secret = "app_client_secret"
|
48
|
+
|
45
49
|
\# Internal redirection to handle the HashBlue response. You'll receive a GET request to that action
|
50
|
+
|
46
51
|
\# after OAuth mechanism with user access token info: :access_token, :expires_in, :refresh_token
|
47
|
-
|
52
|
+
|
53
|
+
Rails.application.config.hashblue.forward_action = "controller#action"
|
48
54
|
|
49
55
|
### Create the logic to handle the OAuth mechanism
|
50
56
|
|
data/Rakefile
CHANGED
@@ -1,2 +1,29 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
require 'rspec/core/rake_task'
|
10
|
+
|
2
11
|
Bundler::GemHelper.install_tasks
|
12
|
+
|
13
|
+
task :default => :test
|
14
|
+
|
15
|
+
RSpec::Core::RakeTask.new(:test) do |spec|
|
16
|
+
spec.skip_bundler = true
|
17
|
+
spec.warning = true
|
18
|
+
spec.pattern = 'spec/*_spec.rb'
|
19
|
+
spec.rspec_opts = '--color --format doc'
|
20
|
+
end
|
21
|
+
|
22
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
23
|
+
rdoc.rdoc_dir = 'rdoc'
|
24
|
+
rdoc.title = 'Hash-Blue'
|
25
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
26
|
+
rdoc.rdoc_files.include('README.md')
|
27
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
28
|
+
end
|
29
|
+
|
data/hash-blue.gemspec
CHANGED
@@ -26,5 +26,9 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.require_paths = ["lib"]
|
27
27
|
|
28
28
|
s.add_dependency("json_pure" , ">= 1.4.3")
|
29
|
-
|
29
|
+
s.add_dependency("oauth")
|
30
|
+
s.add_development_dependency("rspec" , "~> 2.6")
|
31
|
+
s.add_development_dependency("rspec-rails", "~> 2.6")
|
32
|
+
s.add_development_dependency("rails", "~> 3.0")
|
33
|
+
|
30
34
|
end
|
data/lib/hash-blue.rb
CHANGED
@@ -2,6 +2,7 @@ require 'hash_blue/client'
|
|
2
2
|
require 'hash_blue/contact'
|
3
3
|
require 'hash_blue/message'
|
4
4
|
require 'hash_blue/account'
|
5
|
+
require 'hash_blue/version'
|
5
6
|
|
6
7
|
require 'hash_blue/engine' if defined?(Rails)
|
7
8
|
|
@@ -16,4 +17,5 @@ require 'hash_blue/engine' if defined?(Rails)
|
|
16
17
|
#
|
17
18
|
|
18
19
|
module HashBlue
|
20
|
+
|
19
21
|
end
|
data/lib/hash_blue/contact.rb
CHANGED
data/lib/hash_blue/version.rb
CHANGED
data/spec/account_spec.rb
CHANGED
data/spec/contact_spec.rb
CHANGED
data/spec/message_spec.rb
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'hash-blue'
|
4
|
-
require 'webmock/rspec'
|
1
|
+
require 'spec_helper'
|
5
2
|
|
6
3
|
describe HashBlue::Message do
|
7
4
|
before(:all) do
|
@@ -9,7 +6,7 @@ describe HashBlue::Message do
|
|
9
6
|
end
|
10
7
|
|
11
8
|
context "initialize" do
|
12
|
-
it "should be an instance of HashBlue::Message when
|
9
|
+
it "should be an instance of HashBlue::Message when instantiated" do
|
13
10
|
HashBlue::Message.new.should be_an_instance_of(HashBlue::Message)
|
14
11
|
end
|
15
12
|
end
|
@@ -42,7 +39,7 @@ describe HashBlue::Message do
|
|
42
39
|
message[1].should be_an_instance_of(HashBlue::Message)
|
43
40
|
end
|
44
41
|
|
45
|
-
it "should return the first message when
|
42
|
+
it "should return the first message when parameter is :first" do
|
46
43
|
stub_request(:get, "https://api.hashblue.com/messages?per_page=1").
|
47
44
|
with(:headers => {'Accept'=>'*/*', 'Authorization'=>'OAuth XXXXX'}).
|
48
45
|
to_return(:status => 200, :body => '{"messages":[{"uri":"https://api.hashblue.com/messages/foo","timestamp":"2011-05-09T21:43:52Z","sent":true,"contact":{"name":"Mike","uri":"https://api.hashblue.com/contacts/mike","messages":"https://api.hashblue.com/contacts/mike/messages","phone_number":"07711223344","msisdn":"447711223344","email":"mike@foo.com"},"content":"test","favourite":false}]}', :headers => {})
|
metadata
CHANGED
@@ -1,44 +1,82 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: hash-blue
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
4
5
|
prerelease:
|
5
|
-
version: "0.2"
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Juan de Bravo
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-10-13 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: json_pure
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2157514320 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
24
21
|
version: 1.4.3
|
25
22
|
type: :runtime
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2157514320
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: oauth
|
27
|
+
requirement: &2157513860 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2157513860
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &2157513280 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '2.6'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2157513280
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec-rails
|
49
|
+
requirement: &2157512780 !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: *2157512780
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rails
|
60
|
+
requirement: &2157512260 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '3.0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2157512260
|
69
|
+
description: ! "O2 Labs has exposed the power of #blue to developers via a \n simple
|
70
|
+
REST & JSON based API, combined with oAuth2 to developers who can \n create new
|
71
|
+
ways for users to manage their texts and add combine the ubiquity \n of SMS with
|
72
|
+
their applications, users simply grant an application access to \n their messages
|
73
|
+
stream or just certain messages."
|
74
|
+
email:
|
34
75
|
- juandebravo@gmail.com
|
35
76
|
executables: []
|
36
|
-
|
37
77
|
extensions: []
|
38
|
-
|
39
78
|
extra_rdoc_files: []
|
40
|
-
|
41
|
-
files:
|
79
|
+
files:
|
42
80
|
- Gemfile
|
43
81
|
- LICENSE.LGPLv3
|
44
82
|
- README.md
|
@@ -57,35 +95,37 @@ files:
|
|
57
95
|
- spec/account_spec.rb
|
58
96
|
- spec/contact_spec.rb
|
59
97
|
- spec/message_spec.rb
|
60
|
-
has_rdoc: true
|
61
98
|
homepage: https://github.com/juandebravo/hash-blue
|
62
99
|
licenses: []
|
63
|
-
|
64
100
|
post_install_message:
|
65
101
|
rdoc_options: []
|
66
|
-
|
67
|
-
require_paths:
|
102
|
+
require_paths:
|
68
103
|
- lib
|
69
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
105
|
none: false
|
71
|
-
requirements:
|
72
|
-
- -
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version:
|
75
|
-
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
hash: 45749428438786352
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
114
|
none: false
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version:
|
115
|
+
requirements:
|
116
|
+
- - ! '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
hash: 45749428438786352
|
81
122
|
requirements: []
|
82
|
-
|
83
123
|
rubyforge_project: hash-blue
|
84
|
-
rubygems_version: 1.
|
124
|
+
rubygems_version: 1.8.10
|
85
125
|
signing_key:
|
86
126
|
specification_version: 3
|
87
127
|
summary: This gem provides a smooth access to _#_blue API.
|
88
|
-
test_files:
|
128
|
+
test_files:
|
89
129
|
- spec/account_spec.rb
|
90
130
|
- spec/contact_spec.rb
|
91
131
|
- spec/message_spec.rb
|