日本百名山の登頂の軌跡(春山から冬山まで )今まで、百名山28座完成!

圖片
日本百名山の山行歴(春山から冬山まで )

(無雪期) 丹沢主稜線縦走、日光男体山、立山三山、剱岳(別山尾根)、白馬三山縦走、後立山テント泊縦走(白馬八方〜針の木)、穂高〜表銀座縦走(岳沢〜槍ヶ岳〜燕岳)、折立~薬師岳~黑部五郎岳〜鷲羽岳~水岳〜新穂高温泉 (テント担いて縦走)、焼岳、富士山(吉田ルート)、甲斐駒ヶ岳、小仙丈ヶ岳、白根三山縦走(テント担いて縦走)、伯耆大山、石鎚山、屋久島中心部縱走
(積雪期、残雪期) 利尻山、蔵王山、安達太良山、谷川岳(天神尾根)、八ヶ岳の赤岳(文三郎尾根〜地蔵尾根)、唐松岳、雲取山(鴨沢ルート)、奥穂高岳(涸沢から)、富士山(吉田ルート 冬と春)、伊吹山、石鎚山、木曽駒ヶ岳、西穂高岳
山の名前標高(m)登頂記録1利尻岳(りしりだけ)1721完成(春)2羅臼岳(らうすだけ)1660-3斜里岳(しゃりだけ)1547-4阿寒岳(あかんだけ)1499-5大雪山(たいせつざん)2291-6トムラウシ山(とむらうしやま)2141-7十勝岳(とかちだけ)2077-8幌尻岳(ぽろしりだけ)2052-9羊蹄山(ようていざん)1898-10岩木山(いわきさん)1625-11八甲田山(はっこうださん)1584-12八幡平(はちまんたい)1613-13岩手山(いわてさん)2038-14早池峰山(はやちねさん)1917-15鳥海山(ちょうかいさん)2236-16月山(がっさん)1984-17朝日岳(あさひだけ)1870-18蔵王山(ざおうさん)1841撤退(冬)19飯豊山(いいでさん)2128-20吾妻山(あずまさん)2035-21安達太良山(あだたらやま)1699完成(冬)22磐梯山(ばんだいさん)1816-23

Connect LinkedIn Account into your Rails Application with Authlogic and OAuth

LinkedIn launched its new API in November 2009, allowing any developer brave enough to implement OAuth to integrate with one of the largest social networks around. Seeking an opportunity to really understand OAuth more fully and play around with the LinkedIn API at the same time, I created the LinkedIn connect sample code.

This is a sample Ruby on Rails tutorial to demonstrate how you can use the LinkedIn API to authenticate users and pull their profile data into your own website.


GETTING STARTED


Before you can use the LinkedIn API, you'll need to set up your API keys.

Getting Started with the LinkedIn API


1. Where do I begin? Start by navigating to http://developer.linkedin.com. This is Linkedin developer portal where you can read API documentation, collaborate with other developers, and keep abreast of changes to the LinkedIn API. From here, click on “LinkedIn APIs.”

2. Now click on “Request an API Key”

3. After logging in, you’re now presented with an opportunity. You can create as many API keys as you like, one for each application that you create. Let’s get started.


4. This isn’t as complicated as it looks. Let’s look closely.
Application Developers: This is a list of your LinkedIn Connections that will receive network updates published by your application and is used only while it is in development mode. You need to be connected to any LinkedIn member that you want to put on this whitelist. Interface Language: Your application is provided in one or more languages to end users. Let us know what those languages are so we can better support you in the future. Programming Tools: Knowing what kind of programming languages and tools you use to develop your application lets us know what languages and environments are most important for us to support. Just a few more fields to go over!

5. Ready to get your API keys? When you’re done, click “Add Application”
Contact Info: Tell us how to get in contact with you should we have a question about or there is a problem with your application.
OAuth Redirect URL: If you have a static location that should always be used for your OAuth callbacks, you can specify it here. It is recommended that you use the oauth_callback parameter in the appropriate requests instead.
Agreement Language: If you’d like to force the login screen to appear in one of the languages LinkedIn supports, you can set that here. It is recommended to leave the setting at “Browser Locale Setting.”
Terms of Service/CAPTCHA: Please do read our API Terms of Use. You cannot create an API key without agreeing to our terms. You’ve likely seen a CAPTCHA before, and it needs little explanation.



6. You’ve got your API keys. What’s next?
The LinkedIn Developer Network is where you’ll find guidelines, documentation, and growing community of developers.


RUBY GEM INSTALLATION


First you need to upgrade your Rails VERSION to 2.3.x, and install the required Ruby Gems below:

1. Setup and use Authlogic

$ sudo gem install authlogic

2. Install OAuth and Authlogic_Oauth

$ sudo gem install oauth
$ sudo gem install authlogic-oauth

3. Install other required Ruby gems

$ sudo gem install json
$ sudo gem install crack

Or for older version of Rails, you can install it as a plugin:

$ script/plugin install git://github.com/binarylogic/authlogic.git
$ script/plugin install git://github.com/jrallison/authlogic_oauth.git

* Authlogic at Github:http://github.com/binarylogic/authlogic
* Authlogic Example: http://github.com/binarylogic/authlogic_example


SETUP API KEY IN YOUR APP


Create load_linkedin_config.rb in #{RAILS_ROOT}/config/initializers directory

Create linkedin_config.yml in #{RAILS_ROOT}/config directory



DATABASE MIGRATION


1. Make some changes to user table in your database:

$ script/generate migration AddLinkedinConnectToUsers

2. Create Position,Education and Connection model:

$ script/generate model position

$ script/generate model education

$ script/generate model connection


3. Modify the User model, add the content below to the #{RAILS_ROOT}/app/models/user.rb:

The private method "populate_oauth_user", which is called before user record created, and is used to fetch profile info (name, headline, industry, profile pic, public url, summary, specialties, web urls) in LinkedIn.com, and save these info to your user record. The other private method "populate_child_models", which is called after user record created, and which will save past position info (companies, job titles, durations, descriptions), education info (schools, degrees, field of study, dates, etc) and connections info (names, industries, headlines, profile pics) for user.

4. Modify the Connection model, add the contents below to the #{RAILS_ROOT}/app/models/connection.rb:

5. Modify the Education model, add the content below to the #{RAILS_ROOT}/app/models/education.rb:

6. Modify the Position model, add the content below to the #{RAILS_ROOT}/app/models/position.rb:

7. Create UserSession model, and define the oauth_consumer class method on your UserSession model:


CONTROLLER METHOD


You only need to save your objects this way if you want the user to authenticate with their OAuth provider.

That being said, you probably want to do this in your controllers. You should do this for BOTH your User objects and UserSession objects (assuming you are authenticating users). It should look something like this:

You should save your @user objects this way as well, because you also want the user to authenticate with OAuth.

In my case, I have to integrating the LinkedIn OAuth Sign in feature to my current Rails project, so I changed the "Create" method in my UsersController like this way:

When the user click on the LinkedIn Login button and we can't find the oauth_token and oauth_secret in the database, the user will be redirect to signup page with "linkedin_user" parameter. After fill in the fields, they will be redirect to LinkedIn authentication page, then user record will be created. If we can find the oauth_token and oauth_secret in the database, the user will be login to the site.



ADD REGISTER BUTTON


You can simply use the "oauth_register_button" helper method to add LinkedIn register buttons to your views, like this:

Now add some style in your CSS file for LinkedIn button:



NEXT STEPS


Now we have user's LinkedIn data saved in the database, so you can write some codes to show the user's LinkedIn profile data (such as Username, Headline, Location, Education, Position, Websites, Skills, Experience, Connections) in the website.

You may want to add methods to update profile info on each login or update request. Or pull status updates, specialties, and current position for connection.

If you're interested in learning more about LinkedIn and OAuth, I encourage you to checkout Taylor Singletary's presentation LinkedIn OAuth: Zero to Hero.

熱門文章

[轉載] 洛克菲勒寫給兒子的38封信(全文)

Dec 31, 2011 東北雪の鄉&北海道 跨年自由行~卷四。青森・奧入瀨溪、十和田湖、十和田神社、弘前公園、弘前城

2019, July 21【花蓮秀林】羊頭山一日單攻。中橫四辣之老闆這盤好像不會辣

2019.6.15~16【中國安徽】登黃山,天下無山|黃山兩天一夜自助旅行

日本の登山の歷史

【南投信義】玉山國家公園散步★塔塔加六山之三:鹿林山、麟趾山、鹿林前山&八通關古道之雲龍瀑布健行

斗六市70年老店 山姆紅燒羊肉爐

文章列表

聯絡我

名稱

以電子郵件傳送 *

訊息 *