tender-api 0.0.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/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tender-api.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Michael Saffitz
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Tender
2
+
3
+ Wrapper for the [Tender][tender] API.
4
+
5
+ Currently only supports retrieving and creating discussions.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'tender-api'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install tender-api
20
+
21
+ ## Usage
22
+
23
+ ```
24
+ require 'tender'
25
+ client = Tender::Client.new(YOUR_DOMAIN, YOUR_API_KEY)
26
+
27
+ client.get_discussions
28
+ client.put_discussion( CATEGORY_ID, DISCUSSION_ATTRIBUTES )
29
+ ````
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create new Pull Request
38
+
39
+ [tender]: http://tenderapp.com/
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ require 'tender/discussion'
2
+
3
+ module Tender
4
+ class Client
5
+
6
+ attr_accessor :domain, :api_token, :password, :host_format, :domain_format, :protocol, :port
7
+
8
+ def initialize(domain, api_token)
9
+ self.domain = domain # 'tender-api-testing'
10
+ self.api_token = api_token # 'b19343da7748bd4e97d13fcc8b76304a039eb801'
11
+ end
12
+
13
+ def connection
14
+ @conn ||= Faraday.new(url: "https://api.tenderapp.com/#{self.domain}" ) do |faraday|
15
+ faraday.use FaradayMiddleware::EncodeJson
16
+ faraday.use FaradayMiddleware::ParseJson, :content_type => /\bjson$/
17
+ faraday.adapter Faraday.default_adapter
18
+ end
19
+ @conn.headers['Accept'] = "application/vnd.tender-v1+json"
20
+ @conn.headers['X-Tender-Auth'] = self.api_token
21
+ @conn
22
+ end
23
+
24
+ include Tender::Discussion
25
+ end
26
+ end
@@ -0,0 +1,16 @@
1
+ module Tender
2
+ module Discussion
3
+
4
+ def get_discussions
5
+ connection.get("discussions")
6
+ end
7
+
8
+ def create_discussion(category_id, attributes)
9
+ attributes.merge!(skip_spam: true)
10
+ connection.post("categories/#{category_id}/discussions", attributes) do |req|
11
+ req.headers['Content-Type'] = "application/json"
12
+ end
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module Tender
2
+ VERSION = "0.0.1"
3
+ end
data/lib/tender-api.rb ADDED
@@ -0,0 +1 @@
1
+ require 'tender'
data/lib/tender.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "rubygems"
2
+ require "faraday"
3
+ require "faraday_middleware"
4
+ require 'tender/client'
5
+
6
+ module Tender
7
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tender/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "tender-api"
8
+ gem.version = Tender::VERSION
9
+ gem.authors = ["Michael Saffitz"]
10
+ gem.email = ["mike@apptentive.com"]
11
+ gem.description = %q{Ruby API wrapper for Tender - http://tenderapp.com}
12
+ gem.summary = %q{Ruby API wrapper for Tender - http://tenderapp.com}
13
+ gem.homepage = "http://github.com/apptentive/tender-api"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency("faraday", "~>0.8.1")
21
+ gem.add_dependency("faraday_middleware", "~>0.8.8")
22
+
23
+
24
+ gem.add_development_dependency "rake"
25
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tender-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Michael Saffitz
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faraday
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.8.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.1
30
+ - !ruby/object:Gem::Dependency
31
+ name: faraday_middleware
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.8.8
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.8.8
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: Ruby API wrapper for Tender - http://tenderapp.com
63
+ email:
64
+ - mike@apptentive.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - Gemfile
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - lib/tender-api.rb
75
+ - lib/tender.rb
76
+ - lib/tender/client.rb
77
+ - lib/tender/discussion.rb
78
+ - lib/tender/version.rb
79
+ - tender-api.gemspec
80
+ homepage: http://github.com/apptentive/tender-api
81
+ licenses: []
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ segments:
93
+ - 0
94
+ hash: 4330392958250715901
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ segments:
102
+ - 0
103
+ hash: 4330392958250715901
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 1.8.24
107
+ signing_key:
108
+ specification_version: 3
109
+ summary: Ruby API wrapper for Tender - http://tenderapp.com
110
+ test_files: []