mention-api 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03f4c1372ce47e1994002906290ef74120852853
4
- data.tar.gz: f7dce45c4b28b4e5d020c2465237992e31a86de3
3
+ metadata.gz: b742c85aa7a341be13569dccce59b0b6fce4b2b8
4
+ data.tar.gz: a750bdd28a5042daf6a10662add901764b876a0f
5
5
  SHA512:
6
- metadata.gz: 523de97071c722e7e019eab55a81a1d53da380fb70054fb2d31d1971e0d72206c905e2064271f02aa0959cb4baf9e2f474abf4d9aace50e4594dfffc6d6aab59
7
- data.tar.gz: 92373f7c914c9ec5d131bf1b778e521c6322ac6187aac13b58f26e803558665d7c5658487557d48ec85c5fe8a8360b835b88508fc4bac39d5be04af6234ccb4b
6
+ metadata.gz: 7d721068b7faebdb467a30036dd21c8a0542e81bfb81b485b047421ee18e21a0420d38c6b4273958fdd58468d1a6321261bfb9c32f1caf8c9c90e3bef052c379
7
+ data.tar.gz: 0395553e56e43324d1de2855e6bf1eca38c9e0a7db58bd66bf75f60253340e2fb2e24dcedbf5f606d46b1a6bde008e4f5f26cb3508b7e5bd9116fdf045e7eed3
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - 2.0.0
3
+ - 1.9
4
+ - 2.0
5
+ - 2.1
5
6
  - jruby
6
- - rbx-19mode
7
+ - rbx-2.2.6
@@ -45,6 +45,14 @@ module Mention
45
45
  MentionList.new(raw_data)
46
46
  end
47
47
 
48
+ def update_mention_attr(alert, mention, attributes = {})
49
+ headers = {'Content-Type' => 'application/json'}
50
+ payload = attributes.to_json
51
+ raw_data = JSON.parse(resource["/alerts/#{alert.id}/mentions/#{mention.id}"].put(payload, headers))
52
+
53
+ Mention.new(raw_data['mention'])
54
+ end
55
+
48
56
  private
49
57
  attr_reader :account_id, :access_token
50
58
 
@@ -1,5 +1,5 @@
1
1
  module Mention
2
2
  module Api
3
- VERSION = "0.0.3"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -12,6 +12,11 @@ module Mention
12
12
  attribute :source_name, String
13
13
  attribute :source_url, String
14
14
  attribute :language_code, String
15
+ attribute :trashed, Boolean
16
+ end
17
+
18
+ def update_attr(account, alert, attributes = {})
19
+ account.update_mention_attr(alert, self, attributes)
15
20
  end
16
21
  end
17
22
  end
@@ -0,0 +1 @@
1
+ {"mention":{"id":"6299410051","alert_id":759146,"title":"Riding down Hogsback looks fun!! #durango #colorado #mountainbike #fun #exciting #outdoors http:\/\/t.co\/AoMPEYzN7W","description":"Riding down Hogsback looks fun!! #durango #colorado #mountainbike #fun #exciting #outdoors http:\/\/t.co\/AoMPEYzN7W","url":"https:\/\/twitter.com\/VisitDurango\/status\/466792090668916736","display_site":true,"unique_id":"twitter:post\/466792090668916736","published_at":"2014-05-15T04:08:01.50993000+00:00","created_at":"2014-05-15T19:00:07.0+00:00","updated_at":"2014-05-15T19:02:20.0+00:00","favorite":false,"trashed":true,"trashed_set_by_user":true,"read":false,"tone":0,"tone_score":1,"relevance_score":0,"source_type":"twitter","source_name":"VisitDurango","source_url":"https:\/\/twitter.com\/VisitDurango","language_code":"en","tasks":[],"logs":[{"id":"46643331","type":"moved_to_folder","author":{"id":"279833_5dun1xl3jhgkw88sgg8ow4kgso4cok8wo00gskoc4s0cgwog84","name":"John Doe","email":"dudcldu+refxtk@sharklasers.com","language_code":"en","registration_client":"web","inviter_id":"279833_69fmsrgm","created_at":"2014-05-10T17:51:06.0+00:00","updated_at":"2014-05-15T18:58:40.0+00:00"},"created_at":"2014-05-15T19:02:19.0+00:00","from_folder":"inbox","to_folder":"spam"}],"children":[],"picture_url":"https:\/\/pbs.twimg.com\/profile_images\/451389948973686785\/xB6g621__normal.jpeg","twitter_real_name":"Visit Durango","important":false,"offsets":{"title":[],"description":[],"url":[],"source_name":[],"source_url":[]},"permissions":{"favorite":true,"trash":true,"create_task":true}}}
@@ -1,9 +1,13 @@
1
1
  require 'spec_helper_unit'
2
2
 
3
3
  describe Mention::Mention do
4
+ let(:account){ Mention::Account.new(account_id: 'abc', access_token: 'def') }
4
5
  let(:json){ File.read('spec/fixtures/mention_list_default.json') }
5
6
  let(:mention_params){ JSON.parse(json)['mentions'].first }
6
7
  let(:mention){ Mention::Mention.new(mention_params) }
8
+ let(:alert_json){ File.read('spec/fixtures/get_account_alerts.json') }
9
+ let(:alert_params){ JSON.parse(alert_json)['alerts'].first }
10
+ let(:alert){ Mention::Alert.new(alert_params) }
7
11
 
8
12
  it "has some basic information" do
9
13
  mention.id.should == 3253260762
@@ -15,5 +19,20 @@ describe Mention::Mention do
15
19
  mention.source_name.should == "google.com"
16
20
  mention.source_url.should == "https://plus.google.com"
17
21
  mention.language_code == "en"
22
+ mention.trashed == false
23
+ end
24
+
25
+ describe '#update_attr' do
26
+ it 'updates some attribute' do
27
+ stub_request(:put, "https://api.mention.net/api/accounts/abc/alerts/459069/mentions/3253260762").
28
+ with(:body => "{\"trashed\":true}",
29
+ :headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer def'}).
30
+ to_return(:status => 200, :body => File.read("spec/fixtures/mention_update_attr.json"))
31
+
32
+ new_mention = mention.update_attr(account, alert, trashed: true)
33
+ new_mention.trashed.should == true
34
+ a_request(:put, 'https://api.mention.net/api/accounts/abc/alerts/459069/mentions/3253260762').
35
+ with(body: "{\"trashed\":true}").should have_been_made.once
36
+ end
18
37
  end
19
38
  end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mention-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Ries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-30 00:00:00.000000000 Z
11
+ date: 2014-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.14'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.14'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: webmock
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.14'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.14'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rest-client
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 1.6.7
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.6.7
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: virtus
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.0'
97
97
  description: A wrapper for the mention.net API
@@ -101,8 +101,8 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .gitignore
105
- - .travis.yml
104
+ - ".gitignore"
105
+ - ".travis.yml"
106
106
  - Gemfile
107
107
  - LICENSE.txt
108
108
  - README.md
@@ -124,6 +124,7 @@ files:
124
124
  - spec/fixtures/get_account_alerts.json
125
125
  - spec/fixtures/mention_list_default.json
126
126
  - spec/fixtures/mention_list_since.json
127
+ - spec/fixtures/mention_update_attr.json
127
128
  - spec/fixtures/post_account_alerts.json
128
129
  - spec/fixtures/post_account_alerts_failed.json
129
130
  - spec/lib/mention/account_spec.rb
@@ -143,17 +144,17 @@ require_paths:
143
144
  - lib
144
145
  required_ruby_version: !ruby/object:Gem::Requirement
145
146
  requirements:
146
- - - '>='
147
+ - - ">="
147
148
  - !ruby/object:Gem::Version
148
149
  version: '0'
149
150
  required_rubygems_version: !ruby/object:Gem::Requirement
150
151
  requirements:
151
- - - '>='
152
+ - - ">="
152
153
  - !ruby/object:Gem::Version
153
154
  version: '0'
154
155
  requirements: []
155
156
  rubyforge_project:
156
- rubygems_version: 2.0.6
157
+ rubygems_version: 2.2.2
157
158
  signing_key:
158
159
  specification_version: 4
159
160
  summary: A wrapper for the mention.net API
@@ -163,6 +164,7 @@ test_files:
163
164
  - spec/fixtures/get_account_alerts.json
164
165
  - spec/fixtures/mention_list_default.json
165
166
  - spec/fixtures/mention_list_since.json
167
+ - spec/fixtures/mention_update_attr.json
166
168
  - spec/fixtures/post_account_alerts.json
167
169
  - spec/fixtures/post_account_alerts_failed.json
168
170
  - spec/lib/mention/account_spec.rb