awesm 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- = Awesm =
1
+ # Awesm #
2
2
 
3
3
  The *awesm* gem is an easy way to access the awe.sm API (http://totally.awe.sm).
4
4
 
@@ -6,15 +6,24 @@ We're actively developing this (and it's not yet production ready) but please
6
6
  feel free to send us a pull request from a topic branch with specs and an
7
7
  explanation :)
8
8
 
9
- == Usage ==
9
+ ## Usage ##
10
+
11
+ In your Gemfile:
12
+
13
+ ```ruby
14
+ gem 'awesm'
15
+ ```
16
+
17
+ And in your code:
10
18
 
11
19
  ```ruby
12
20
  Awesm.subscription_key = 'sub-xxxxxx'
21
+ Awesm.application_key = 'app-xxxxxx'
13
22
  project = Awesm::Project.create(:name => 'Totally Awe.sm!')
14
23
  project.api_key # => '1234567890abcdefghijklmnopqrstuvwxyz'
15
24
  ```
16
25
 
17
- == Contributing ==
26
+ ## Contributing ##
18
27
 
19
28
  * fork
20
29
  * clone
@@ -24,7 +33,11 @@ project.api_key # => '1234567890abcdefghijklmnopqrstuvwxyz'
24
33
  * push to a topic branch
25
34
  * send us a pull request :)
26
35
 
27
- == Manitainers ==
36
+ ## Manitainers ##
28
37
 
29
38
  * *Sathya Sekaran*
30
39
  * *Michael Durnhofer*
40
+
41
+ ## Many Thanks To ##
42
+ * our employer, Topspin Media, Inc. (http://topspinmedia.com)
43
+ * and the good folks at awe.sm (http://totally.awe.sm)
@@ -3,6 +3,7 @@ require 'awesm/version'
3
3
  require 'httparty'
4
4
  require 'json'
5
5
  require 'hashie'
6
+ require 'ruby-debug'
6
7
 
7
8
  module Awesm
8
9
  def self.subscription_key=(key)
@@ -13,12 +14,20 @@ module Awesm
13
14
  @@subscription_key
14
15
  end
15
16
 
17
+ def self.application_key=(key)
18
+ @@application_key = key
19
+ end
20
+
21
+ def self.application_key
22
+ @@application_key
23
+ end
24
+
16
25
  class Project < Hashie::Mash
17
26
  include HTTParty
18
27
  base_uri 'http://api.awe.sm/projects'
19
28
 
20
29
  def self.create(attributes)
21
- response = post('/new', :query => { :subscription_key => Awesm.subscription_key, :json => attributes.to_json })
30
+ response = post('/new', :query => { :application_key => Awesm.application_key, :subscription_key => Awesm.subscription_key, :json => attributes.to_json })
22
31
  new(response['response']['project'])
23
32
  end
24
33
  end
@@ -1,3 +1,3 @@
1
1
  module Awesm
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -8,13 +8,24 @@ describe Awesm do
8
8
  end
9
9
  end
10
10
 
11
- after(:each) { Awesm.subscription_key = nil }
11
+ describe '.application_key=' do
12
+ it 'sets the application key' do
13
+ Awesm.application_key = '1234567890'
14
+ Awesm.application_key.should == '1234567890'
15
+ end
16
+ end
17
+
18
+ after(:each) do
19
+ Awesm.subscription_key = nil
20
+ Awesm.application_key = nil
21
+ end
12
22
  end
13
23
 
14
24
  describe Awesm::Project do
15
25
  let(:json_response) do
16
26
  {
17
27
  "request" => {
28
+ "application_key" => "app-xxxxxx",
18
29
  "json" => "{\"name\" =>\"Totally Awesome Project\"}",
19
30
  "method" => "new",
20
31
  "object" => "project",
@@ -38,10 +49,14 @@ describe Awesm::Project do
38
49
 
39
50
  before do
40
51
  Awesm.subscription_key = 'sub-xxxxxx'
41
- stub_request(:post, "http://api.awe.sm/projects/new?json=%7B%22name%22:%22Totally%20Awesome%20Project%22%7D&subscription_key=sub-xxxxxx").
52
+ Awesm.application_key = 'app-xxxxxx'
53
+ stub_request(:post, "http://api.awe.sm/projects/new?json=%7B%22name%22:%22Totally%20Awesome%20Project%22%7D&subscription_key=sub-xxxxxx&application_key=app-xxxxxx").
42
54
  to_return(:status => 200, :body => json_response, :headers => { 'Content-Type' => 'application/json;charset=utf-8' })
43
55
  end
44
- after { Awesm.subscription_key = nil }
56
+ after do
57
+ Awesm.subscription_key = nil
58
+ Awesm.application_key = nil
59
+ end
45
60
 
46
61
  context '.create' do
47
62
  it 'returns an Awesm::Project' do
@@ -53,7 +68,7 @@ describe Awesm::Project do
53
68
  Awesm::Project.create({ :name => "Totally Awesome Project" })
54
69
 
55
70
  a_request(:post, "http://api.awe.sm/projects/new").
56
- with(:query => {:subscription_key => "sub-xxxxxx", :json => { "name" => "Totally Awesome Project" }.to_json }).
71
+ with(:query => {:subscription_key => "sub-xxxxxx", :application_key => "app-xxxxxx", :json => { "name" => "Totally Awesome Project" }.to_json }).
57
72
  should have_been_made.once
58
73
  end
59
74
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awesm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sathya Sekaran
@@ -16,11 +16,11 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-11-17 00:00:00 Z
19
+ date: 2011-11-18 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
+ name: rake
22
23
  prerelease: false
23
- type: :development
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
@@ -30,11 +30,11 @@ dependencies:
30
30
  segments:
31
31
  - 0
32
32
  version: "0"
33
- name: rake
33
+ type: :development
34
34
  version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
+ name: rspec
36
37
  prerelease: false
37
- type: :development
38
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
@@ -44,11 +44,11 @@ dependencies:
44
44
  segments:
45
45
  - 0
46
46
  version: "0"
47
- name: rspec
47
+ type: :development
48
48
  version_requirements: *id002
49
49
  - !ruby/object:Gem::Dependency
50
+ name: webmock
50
51
  prerelease: false
51
- type: :development
52
52
  requirement: &id003 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
@@ -58,11 +58,11 @@ dependencies:
58
58
  segments:
59
59
  - 0
60
60
  version: "0"
61
- name: webmock
61
+ type: :development
62
62
  version_requirements: *id003
63
63
  - !ruby/object:Gem::Dependency
64
+ name: httparty
64
65
  prerelease: false
65
- type: :development
66
66
  requirement: &id004 !ruby/object:Gem::Requirement
67
67
  none: false
68
68
  requirements:
@@ -72,11 +72,11 @@ dependencies:
72
72
  segments:
73
73
  - 0
74
74
  version: "0"
75
- name: httparty
75
+ type: :development
76
76
  version_requirements: *id004
77
77
  - !ruby/object:Gem::Dependency
78
+ name: json
78
79
  prerelease: false
79
- type: :development
80
80
  requirement: &id005 !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
@@ -86,11 +86,11 @@ dependencies:
86
86
  segments:
87
87
  - 0
88
88
  version: "0"
89
- name: json
89
+ type: :development
90
90
  version_requirements: *id005
91
91
  - !ruby/object:Gem::Dependency
92
+ name: hashie
92
93
  prerelease: false
93
- type: :development
94
94
  requirement: &id006 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
@@ -100,11 +100,11 @@ dependencies:
100
100
  segments:
101
101
  - 0
102
102
  version: "0"
103
- name: hashie
103
+ type: :development
104
104
  version_requirements: *id006
105
105
  - !ruby/object:Gem::Dependency
106
+ name: ruby-debug
106
107
  prerelease: false
107
- type: :development
108
108
  requirement: &id007 !ruby/object:Gem::Requirement
109
109
  none: false
110
110
  requirements:
@@ -114,11 +114,11 @@ dependencies:
114
114
  segments:
115
115
  - 0
116
116
  version: "0"
117
- name: ruby-debug
117
+ type: :development
118
118
  version_requirements: *id007
119
119
  - !ruby/object:Gem::Dependency
120
+ name: httparty
120
121
  prerelease: false
121
- type: :runtime
122
122
  requirement: &id008 !ruby/object:Gem::Requirement
123
123
  none: false
124
124
  requirements:
@@ -128,11 +128,11 @@ dependencies:
128
128
  segments:
129
129
  - 0
130
130
  version: "0"
131
- name: httparty
131
+ type: :runtime
132
132
  version_requirements: *id008
133
133
  - !ruby/object:Gem::Dependency
134
+ name: json
134
135
  prerelease: false
135
- type: :runtime
136
136
  requirement: &id009 !ruby/object:Gem::Requirement
137
137
  none: false
138
138
  requirements:
@@ -142,11 +142,11 @@ dependencies:
142
142
  segments:
143
143
  - 0
144
144
  version: "0"
145
- name: json
145
+ type: :runtime
146
146
  version_requirements: *id009
147
147
  - !ruby/object:Gem::Dependency
148
+ name: hashie
148
149
  prerelease: false
149
- type: :runtime
150
150
  requirement: &id010 !ruby/object:Gem::Requirement
151
151
  none: false
152
152
  requirements:
@@ -156,7 +156,7 @@ dependencies:
156
156
  segments:
157
157
  - 0
158
158
  version: "0"
159
- name: hashie
159
+ type: :runtime
160
160
  version_requirements: *id010
161
161
  description: The 'awesm' gem is an interface for awe.sm (http://totally.awe.sm), a social link analytics tracking service.
162
162
  email: