mingle_party 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +14 -0
  2. data/lib/mingle_party.rb +53 -0
  3. metadata +80 -0
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ mingle_party
2
+ ==========
3
+
4
+ Party with the Mingle API
5
+
6
+
7
+ Usage
8
+ -----
9
+
10
+ Example client to use the Mingle API in ruby.
11
+
12
+
13
+ Copyright (c) Sudhindra Rao 2012
14
+ This project is available for use in compliance with the Apache License.
@@ -0,0 +1,53 @@
1
+ require 'httparty'
2
+ require 'crack'
3
+
4
+ class MingleParty
5
+ include HTTParty
6
+
7
+ def initialize
8
+ config = YAML.load(File.read("./config.yml")).first
9
+ @uri = "#{config['host']}/api/v2/projects/#{config['project']}"
10
+ auth = { username: config['username'], password: config['password'] }
11
+ @auth_options = { :basic_auth => auth }
12
+ end
13
+
14
+ def create_card(name, card_type)
15
+ options = @auth_options.merge({ query: {'card[name]' => name, 'card[card_type_name]' => card_type } })
16
+ response = self.class.post("#{@uri}/cards.xml", options)
17
+ end
18
+
19
+ def change_card_status(number, status)
20
+ options = @auth_options.merge({ query: { 'card[properties[][name]' => 'status', 'card[properties][][value]' => status } })
21
+ response = self.class.put( "#{@uri}/cards/#{number}.xml", options )
22
+ end
23
+
24
+ def fetch_card(number)
25
+ response = self.class.get( "#{@uri}/cards/#{number}.xml", @auth_options )
26
+ Crack::XML.parse( response.body )
27
+ end
28
+
29
+ def murmur(message, command)
30
+ options = @auth_options.merge( { query: { "#{command}".to_sym => message } } )
31
+ response = self.class.post( "#{@uri}/murmurs.xml", options )
32
+ end
33
+
34
+ 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]} })
39
+ self.class.post("#{@uri}/users.xml", options)
40
+ end
41
+
42
+ def fetch_users
43
+ response = self.class.get( "#{@uri}/users.xml", @auth_options )
44
+ puts "[DEBUG] response => #{response.inspect}"
45
+
46
+ Crack::XML.parse( response.body )
47
+ end
48
+
49
+ def fetch_user(id)
50
+ response = self.class.get( "#{@uri}/users/#{id}.xml", @auth_options )
51
+ Crack::XML.parse( response.body )
52
+ end
53
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mingle_party
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - betarelease
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70131062130380 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70131062130380
25
+ - !ruby/object:Gem::Dependency
26
+ name: crack
27
+ requirement: &70131062129640 !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: *70131062129640
36
+ - !ruby/object:Gem::Dependency
37
+ name: httparty
38
+ requirement: &70131062128800 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70131062128800
47
+ description: An example implementation that demonstrates how to use Mingle API
48
+ email:
49
+ - sudhindra.r.rao@gmail.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - lib/mingle_party.rb
55
+ - README.md
56
+ homepage: http://github.com/betarelease/mingle_party
57
+ licenses: []
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project: mingle_party
76
+ rubygems_version: 1.8.17
77
+ signing_key:
78
+ specification_version: 3
79
+ summary: A gem to consume Mingle API using HTTParty
80
+ test_files: []