mage-hand 0.4.9 → 0.4.10

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.9
1
+ 0.4.10
@@ -6,7 +6,7 @@ module MageHand
6
6
  attr_simple :name, :campaign_url, :role, :visibility
7
7
 
8
8
  attr_simple :slug
9
- attr_instance :game_master, :class_name => 'User'
9
+ attr_instance :game_master, :class_name => 'OPUser'
10
10
  inflate_if_nil :game_master, :slug
11
11
 
12
12
  # Private/Friends
@@ -17,7 +17,7 @@ module MageHand
17
17
  attr_simple :lat, :lng
18
18
  inflate_if_nil :lat, :lng
19
19
 
20
- attr_array :players, :class_name => 'User'
20
+ attr_array :players, :class_name => 'OPUser'
21
21
  inflate_if_nil :players
22
22
 
23
23
  def self.find_by_slug(slug)
@@ -48,7 +48,7 @@ module MageHand
48
48
  end
49
49
 
50
50
  def current_user
51
- @current_user ||= MageHand::User.new(self, JSON.parse(access_token.get('/v1/users/me.json').body))
51
+ @current_user ||= OPUser.new(self, JSON.parse(access_token.get('/v1/users/me.json').body))
52
52
  end
53
53
  alias :me :current_user
54
54
 
@@ -1,4 +1,5 @@
1
1
  module MageHand
2
2
  class MageHandNotInitialized < StandardError; end
3
3
  class OAuthConfigurationError < StandardError; end
4
+ class WikiPageExists < StandardError; end
4
5
  end
@@ -52,7 +52,13 @@ module MageHand
52
52
  json_body = {'wiki_page' => self.to_hash}.to_json
53
53
  @response = client.access_token.post(self.class.collection_url(self.campaign.id),
54
54
  json_body, {'content-type' => 'application/x-www-form-urlencoded'})
55
- self.update_attributes!(JSON.parse(@response.body))
55
+ puts "#{@response.code}: #{@response.message}"
56
+ puts @response.body
57
+ if @response.code == 200
58
+ self.update_attributes!(JSON.parse(@response.body))
59
+ else
60
+ raise WikiPageExists if @response.body =~ /Name has already been taken/
61
+ end
56
62
  end
57
63
  end
58
64
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "mage-hand"
8
- s.version = "0.4.9"
8
+ s.version = "0.4.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Steven Hammond"]
12
- s.date = "2012-03-31"
12
+ s.date = "2012-04-13"
13
13
  s.description = "mage-hand is a ghostly hand that reaches across the internet to access the Obsidian Portal API."
14
14
  s.email = "shammond@northpub.com"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mage-hand
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-31 00:00:00.000000000 Z
12
+ date: 2012-04-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth
@@ -221,7 +221,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
221
221
  version: '0'
222
222
  segments:
223
223
  - 0
224
- hash: -4216612953549198741
224
+ hash: -1917727301240543020
225
225
  required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  none: false
227
227
  requirements: