event_girl_client 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.3"
4
+ - "2.0.0"
5
+ script: 'bundle exec rspec spec'
6
+
7
+ notifications:
8
+ email:
9
+ - tam.eastley@gmail.com
10
+ - susanne.dewein@gmail.com
11
+ - carsten.zimmermann@absolventa.de
12
+ - felix@mohnert.de
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ # Changelog
2
+
3
+ ## v1.1.0
4
+ - Fix Ruby 1.9.3 issues
5
+ - Removed ActiveSupport dependency
6
+ - Add ``--debug`` option for cmd line tool
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # EventGirlClient
1
+ # EventGirlClient [![Code Climate](https://codeclimate.com/github/Absolventa/event_girl_client.png)](https://codeclimate.com/github/Absolventa/event_girl_client) [![Build Status](https://travis-ci.org/Absolventa/event_girl_client.png?branch=master)](https://travis-ci.org/Absolventa/event_girl_client)
2
2
 
3
3
  EventGirlClient can be used in your own app to send
4
4
  events to an external Event Girl Application such as
@@ -6,8 +6,8 @@ events to an external Event Girl Application such as
6
6
  It is the gem for [Event Girl](https://github.com/Absolventa/event_girl)
7
7
  which was part of a project
8
8
  for the [Rails Girls Summer of Code](http://railsgirlssummerofcode.org).
9
- Its two main contributors are the
10
- Rails Girls Susanne and Tam who worked on the project
9
+ Its three main contributors are the
10
+ Rails Girls Susanne and Tam, and their coach Carsten, who worked on the project
11
11
  from July 2 - September 30, 2013 at the [ABSOLVENTA](http://www.absolventa.de)
12
12
  offices in Berlin.
13
13
 
@@ -18,6 +18,8 @@ Using an initializer file for Rails, you can do:
18
18
  config.url = 'http://my-eventgirl-endpoint.example.com'
19
19
  end
20
20
 
21
+ The gem also includes a command line executable. See ``event_girl -h`` for further details.
22
+
21
23
  ## Installation
22
24
 
23
25
  Add this line to your application's Gemfile:
@@ -34,12 +36,14 @@ Or install it yourself as:
34
36
 
35
37
  ## Usage
36
38
 
37
- - Get the URL you want to send the event to
38
- - example: www.event-girl.herokuapp.com/incoming_events
39
- - Create an API token via the Event Girl application
40
- - Insert the `send_event(title)` method into your code
41
- - title must be the title of the event you want to track
42
- - Start sending events!
39
+ Get the URL you want to send the event to (example: www.event-girl.herokuapp.com/incoming_events)
40
+
41
+ Create a remote side and get its API token via the Event Girl application.
42
+
43
+ Create an instance and start sending events:
44
+
45
+ client = EventGirl::Client.new('http://example.com', 'mytoken')
46
+ client.send_event 'hello from event girl client'
43
47
 
44
48
  ## Contributing
45
49
 
data/bin/event_girl CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- # vim: ft=ruby
3
2
  # encoding: utf-8
3
+ # vim: ft=ruby
4
4
 
5
5
  begin
6
6
  require 'event_girl_client'
@@ -26,6 +26,9 @@ option_parser = OptionParser.new do |opts|
26
26
  opts.on('-s', '--site URL', 'URL of API endpoint') do |url|
27
27
  options[:url] = url
28
28
  end
29
+ opts.on('--debug', 'Display full stack traces') do
30
+ options[:debug] = true
31
+ end
29
32
  opts.on_tail('--version', 'Display version and exit') do
30
33
  puts opts.ver
31
34
  puts
@@ -52,6 +55,12 @@ if ARGV.empty?
52
55
  exit 1
53
56
  end
54
57
 
55
- client = EventGirl::Client.new(options[:url], options[:api_token])
56
- client.send_event(ARGV[0])
58
+ begin
59
+ client = EventGirl::Client.new(options[:url], options[:api_token])
60
+ client.send_event(ARGV[0])
61
+ rescue => e
62
+ puts "E: #{e.message}"
63
+ puts e.backtrace if options[:debug]
64
+ exit 1
65
+ end
57
66
  exit 0
@@ -6,8 +6,8 @@ require 'event_girl_client'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "event_girl_client"
8
8
  spec.version = EventGirl::Client::VERSION
9
- spec.authors = ["Susanne Dewein", "Tam Eastley"]
10
- spec.email = ["susanne.dewein@gmail.com", "tam.eastley@gmail.com"]
9
+ spec.authors = ["Susanne Dewein", "Tam Eastley", "Carsten Zimmermann"]
10
+ spec.email = ["susanne.dewein@gmail.com", "tam.eastley@gmail.com", "cz@aegisnet.de"]
11
11
  spec.description = %q{Ruby client library to connect to event_girl app}
12
12
  spec.summary = %q{Ruby client library to connect to event_girl app}
13
13
  spec.homepage = ""
@@ -18,8 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "activesupport", ">= 3.0", "< 4.1"
22
-
23
21
  spec.add_development_dependency "bundler", "~> 1.3"
24
22
  spec.add_development_dependency "rspec", "~> 2.14"
25
23
  spec.add_development_dependency "rake"
@@ -1,15 +1,17 @@
1
1
  require 'net/http'
2
2
  require 'uri'
3
- require 'active_support/core_ext/class'
4
3
 
5
4
  require 'rubygems'
6
5
 
7
6
  module EventGirl
8
7
  class Client
9
8
 
10
- VERSION = '1.0.0'
9
+ VERSION = '1.1.0'
10
+
11
+ # Class-wide configuration
12
+ @@api_token = nil
13
+ @@url = nil
11
14
 
12
- cattr_accessor :api_token, :url
13
15
  attr_reader :api_token, :url
14
16
 
15
17
  def initialize(url = nil, api_token = nil)
@@ -18,6 +20,7 @@ module EventGirl
18
20
  raise ArgumentError.new('No url provided.') unless @url
19
21
  end
20
22
 
23
+ # POSTs a string to the event_girl server.
21
24
  def send_event(title)
22
25
  uri = URI.parse(url)
23
26
 
@@ -39,5 +42,16 @@ module EventGirl
39
42
  def self.configure
40
43
  yield self if block_given?
41
44
  end
45
+
46
+ # class attribute accessors:
47
+ class_variables.map{|cvar| cvar.to_s.gsub('@@', '') }.each do |cattr|
48
+ define_singleton_method cattr do
49
+ class_variable_get :"@@#{cattr}"
50
+ end
51
+ define_singleton_method "#{cattr}=" do |value|
52
+ class_variable_set "@@#{cattr}", value
53
+ end
54
+ end
55
+
42
56
  end
43
57
  end
metadata CHANGED
@@ -1,39 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_girl_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Susanne Dewein
8
9
  - Tam Eastley
10
+ - Carsten Zimmermann
9
11
  autorequire:
10
12
  bindir: bin
11
13
  cert_chain: []
12
- date: 2013-09-30 00:00:00.000000000 Z
14
+ date: 2013-10-01 00:00:00.000000000 Z
13
15
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: activesupport
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - '>='
19
- - !ruby/object:Gem::Version
20
- version: '3.0'
21
- - - <
22
- - !ruby/object:Gem::Version
23
- version: '4.1'
24
- type: :runtime
25
- prerelease: false
26
- version_requirements: !ruby/object:Gem::Requirement
27
- requirements:
28
- - - '>='
29
- - !ruby/object:Gem::Version
30
- version: '3.0'
31
- - - <
32
- - !ruby/object:Gem::Version
33
- version: '4.1'
34
16
  - !ruby/object:Gem::Dependency
35
17
  name: bundler
36
18
  requirement: !ruby/object:Gem::Requirement
19
+ none: false
37
20
  requirements:
38
21
  - - ~>
39
22
  - !ruby/object:Gem::Version
@@ -41,6 +24,7 @@ dependencies:
41
24
  type: :development
42
25
  prerelease: false
43
26
  version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
44
28
  requirements:
45
29
  - - ~>
46
30
  - !ruby/object:Gem::Version
@@ -48,6 +32,7 @@ dependencies:
48
32
  - !ruby/object:Gem::Dependency
49
33
  name: rspec
50
34
  requirement: !ruby/object:Gem::Requirement
35
+ none: false
51
36
  requirements:
52
37
  - - ~>
53
38
  - !ruby/object:Gem::Version
@@ -55,6 +40,7 @@ dependencies:
55
40
  type: :development
56
41
  prerelease: false
57
42
  version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
58
44
  requirements:
59
45
  - - ~>
60
46
  - !ruby/object:Gem::Version
@@ -62,35 +48,40 @@ dependencies:
62
48
  - !ruby/object:Gem::Dependency
63
49
  name: rake
64
50
  requirement: !ruby/object:Gem::Requirement
51
+ none: false
65
52
  requirements:
66
- - - '>='
53
+ - - ! '>='
67
54
  - !ruby/object:Gem::Version
68
55
  version: '0'
69
56
  type: :development
70
57
  prerelease: false
71
58
  version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
72
60
  requirements:
73
- - - '>='
61
+ - - ! '>='
74
62
  - !ruby/object:Gem::Version
75
63
  version: '0'
76
64
  - !ruby/object:Gem::Dependency
77
65
  name: webmock
78
66
  requirement: !ruby/object:Gem::Requirement
67
+ none: false
79
68
  requirements:
80
- - - '>='
69
+ - - ! '>='
81
70
  - !ruby/object:Gem::Version
82
71
  version: '0'
83
72
  type: :development
84
73
  prerelease: false
85
74
  version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
86
76
  requirements:
87
- - - '>='
77
+ - - ! '>='
88
78
  - !ruby/object:Gem::Version
89
79
  version: '0'
90
80
  description: Ruby client library to connect to event_girl app
91
81
  email:
92
82
  - susanne.dewein@gmail.com
93
83
  - tam.eastley@gmail.com
84
+ - cz@aegisnet.de
94
85
  executables:
95
86
  - event_girl
96
87
  extensions: []
@@ -99,6 +90,8 @@ files:
99
90
  - .gitignore
100
91
  - .ruby-gemset
101
92
  - .ruby-version
93
+ - .travis.yml
94
+ - CHANGELOG.md
102
95
  - Gemfile
103
96
  - LICENSE.txt
104
97
  - README.md
@@ -111,26 +104,33 @@ files:
111
104
  homepage: ''
112
105
  licenses:
113
106
  - MIT
114
- metadata: {}
115
107
  post_install_message:
116
108
  rdoc_options: []
117
109
  require_paths:
118
110
  - lib
119
111
  required_ruby_version: !ruby/object:Gem::Requirement
112
+ none: false
120
113
  requirements:
121
- - - '>='
114
+ - - ! '>='
122
115
  - !ruby/object:Gem::Version
123
116
  version: '0'
117
+ segments:
118
+ - 0
119
+ hash: 90694944730678737
124
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
+ none: false
125
122
  requirements:
126
- - - '>='
123
+ - - ! '>='
127
124
  - !ruby/object:Gem::Version
128
125
  version: '0'
126
+ segments:
127
+ - 0
128
+ hash: 90694944730678737
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 2.0.3
131
+ rubygems_version: 1.8.25
132
132
  signing_key:
133
- specification_version: 4
133
+ specification_version: 3
134
134
  summary: Ruby client library to connect to event_girl app
135
135
  test_files:
136
136
  - spec/client_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: c2397f94943016aa59c3c0fca30206895f661e49
4
- data.tar.gz: 0b5c3e16b4ef47c32ab7cd1bcd801bae5e36d114
5
- SHA512:
6
- metadata.gz: 98c230c7d5b13868f75c3b312f0931668c758730106004cd4ebe910818db11bcc52653df5607fbb36d88901b61a901bad0e1aa96a2a7431cf19ef7fcc5d00f81
7
- data.tar.gz: aefc97b7038b3cc8bd43f7a9b5df2a7cfc02d2ac58586215aececfe4602c817fa16639bf7f485b2504ca0a5577bb3ddb189cab38778a9de3daccdf4a2be87f7f