mingle_party 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/mingle_party.rb +27 -11
  2. metadata +24 -9
data/lib/mingle_party.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'httparty'
2
2
  require 'crack'
3
+ require 'rexml/document'
3
4
 
4
5
  class MingleParty
5
6
  include HTTParty
@@ -10,7 +11,7 @@ class MingleParty
10
11
  auth = { username: config['username'], password: config['password'] }
11
12
  @auth_options = { :basic_auth => auth }
12
13
  end
13
-
14
+
14
15
  def create_card(name, card_type)
15
16
  options = @auth_options.merge({ query: {'card[name]' => name, 'card[card_type_name]' => card_type } })
16
17
  response = self.class.post("#{@uri}/cards.xml", options)
@@ -21,31 +22,46 @@ class MingleParty
21
22
  response = self.class.put( "#{@uri}/cards/#{number}.xml", options )
22
23
  end
23
24
 
24
- def fetch_card(number)
25
+ def fetch_card(number)
25
26
  response = self.class.get( "#{@uri}/cards/#{number}.xml", @auth_options )
26
27
  Crack::XML.parse( response.body )
27
28
  end
28
29
 
30
+ def fetch_cards
31
+ response = self.class.get( "#{@uri}/cards.xml", @auth_options )
32
+ Crack::XML.parse( response.body )
33
+ end
34
+
35
+ =begin
36
+ def delete_card(number)
37
+ self.class.delete( "#{@uri}/cards/#{number}")
38
+ end
39
+
40
+ def delete_cards
41
+ response = fetch_cards
42
+ response['cards'].each{|card| delete_card(card['number'].to_i)}
43
+ response.each {|key, value| puts "#{key}" }
44
+ end
45
+ =end
46
+
29
47
  def murmur(message, command)
30
48
  options = @auth_options.merge( { query: { "#{command}".to_sym => message } } )
31
49
  response = self.class.post( "#{@uri}/murmurs.xml", options )
32
50
  end
33
-
51
+
34
52
  def create_user(user)
35
- options = @auth_options.merge({ query: { 'user[name]' => user[:name], 'user[login]' => user[:login],
36
- 'user[email]' => user[:email], 'user[admin]' => user[:admin],
37
- 'user[password]' => user[:password],
38
- 'user[password_confirmation]' => user[:password_confirmation]} })
53
+ options = @auth_options.merge({ query: { 'user[name]' => user[:name], 'user[login]' => user[:login],
54
+ 'user[email]' => user[:email], 'user[admin]' => user[:admin],
55
+ 'user[password]' => user[:password],
56
+ 'user[password_confirmation]' => user[:password_confirmation]} })
39
57
  self.class.post("#{@uri}/users.xml", options)
40
58
  end
41
-
59
+
42
60
  def fetch_users
43
61
  response = self.class.get( "#{@uri}/users.xml", @auth_options )
44
- puts "[DEBUG] response => #{response.inspect}"
45
-
46
62
  Crack::XML.parse( response.body )
47
63
  end
48
-
64
+
49
65
  def fetch_user(id)
50
66
  response = self.class.get( "#{@uri}/users/#{id}.xml", @auth_options )
51
67
  Crack::XML.parse( response.body )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mingle_party
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
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: 2013-04-03 00:00:00.000000000 Z
12
+ date: 2013-04-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70131062130380 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70131062130380
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: crack
27
- requirement: &70131062129640 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70131062129640
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: httparty
38
- requirement: &70131062128800 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,7 +53,12 @@ dependencies:
43
53
  version: '0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70131062128800
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  description: An example implementation that demonstrates how to use Mingle API
48
63
  email:
49
64
  - sudhindra.r.rao@gmail.com
@@ -73,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
88
  version: '0'
74
89
  requirements: []
75
90
  rubyforge_project: mingle_party
76
- rubygems_version: 1.8.17
91
+ rubygems_version: 1.8.25
77
92
  signing_key:
78
93
  specification_version: 3
79
94
  summary: A gem to consume Mingle API using HTTParty